text stringlengths 424 69.5k |
|---|
### Prompt
Please create a solution in CPP to the following problem:
A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rectangle w... |
### Prompt
Please formulate a Cpp solution to the following problem:
You are given a rooted tree. Each vertex contains a_i tons of gold, which costs c_i per one ton. Initially, the tree consists only a root numbered 0 with a_0 tons of gold and price c_0 per ton.
There are q queries. Each query has one of two types: ... |
### Prompt
Create a solution in Cpp for the following problem:
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 furniture, or free. A ... |
### Prompt
In Cpp, your task is to solve the following problem:
'In Boolean logic, a formula is in conjunctive normal form (CNF) or clausal normal form if it is a conjunction of clauses, where a clause is a disjunction of literals' (cited from https://en.wikipedia.org/wiki/Conjunctive_normal_form)
In the other words... |
### Prompt
In cpp, your task is to solve the following problem:
There are b boys and g girls participating in Olympiad of Metropolises. There will be a board games tournament in the evening and n participants have accepted the invitation. The organizers do not know how many boys and girls are among them.
Organizers ... |
### Prompt
Construct a cpp code solution to the problem outlined:
Note that the memory limit is unusual.
You are given an integer n and two sequences a_1, a_2, ..., a_n and b_1, b_2, ..., b_n.
Let's call a set of integers S such that S ⊆ \{1, 2, 3, ..., n\} strange, if, for every element i of S, the following condi... |
### Prompt
In cpp, your task is to solve the following problem:
M-kun is a student in Aoki High School, where a year is divided into N terms.
There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows:
* For the first through (K-1)-th terms:... |
### Prompt
Generate a CPP solution to the following problem:
The sequence is called ordered if it is non-decreasing or non-increasing. For example, sequnces [3, 1, 1, 0] and [1, 2, 3, 100] are ordered, but the sequence [1, 3, 3, 1] is not. You are given a sequence of numbers. You are to find it's shortest subsequence... |
### 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
Please formulate a cpp solution to the following problem:
In one of the games Arkady is fond of the game process happens on a rectangular field. In the game process Arkady can buy extensions for his field, each extension enlarges one of the field sizes in a particular number of times. Formally, there are n... |
### Prompt
Your task is to create a CPP solution to the following problem:
In order to celebrate Twice's 5th anniversary, Tzuyu and Sana decided to play a game.
Tzuyu gave Sana two integers a and b and a really important quest.
In order to complete the quest, Sana has to output the smallest possible value of (a ⊕ x... |
### Prompt
Please formulate a cpp solution to the following problem:
Professor GukiZ was playing with arrays again and accidentally discovered new function, which he called GukiZiana. For given array a, indexed with integers from 1 to n, and number y, GukiZiana(a, y) represents maximum value of j - i, such that aj = ... |
### Prompt
Generate a Cpp solution to the following problem:
On vacations n pupils decided to go on excursion and gather all together. They need to overcome the path with the length l meters. Each of the pupils will go with the speed equal to v1. To get to the excursion quickly, it was decided to rent a bus, which ha... |
### Prompt
In cpp, your task is to solve the following problem:
Okabe needs bananas for one of his experiments for some strange reason. So he decides to go to the forest and cut banana trees.
Consider the point (x, y) in the 2D plane such that x and y are integers and 0 ≤ x, y. There is a tree in such a point, and i... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Now, a ninja is planning to sneak into the castle tower from outside the castle. This ninja can easily run on the ground and swim in the moat, but he is not very good at climbing up from the moat, so he wants to enter the moat as few times... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
problem
In one river, there is a slightly dangerous game of jumping from one shore to the other on a stone.
<image>
Now, as shown in Figure 4-1 we consider the stone to be above the squares. The number of rows is n. In Figure 4-1 we h... |
### Prompt
Please formulate a cpp solution to the following problem:
Vasya often uses public transport. The transport in the city is of two types: trolleys and buses. The city has n buses and m trolleys, the buses are numbered by integers from 1 to n, the trolleys are numbered by integers from 1 to m.
Public transpo... |
### Prompt
Please provide a CPP coded solution to the problem described below:
You are given a ternary string (it is a string which consists only of characters '0', '1' and '2').
You can swap any two adjacent (consecutive) characters '0' and '1' (i.e. replace "01" with "10" or vice versa) or any two adjacent (consec... |
### Prompt
Your task is to create a CPP solution to the following problem:
Areas on the Cross-Section Diagram
Your task is to simulate a flood damage.
For a given cross-section diagram, reports areas of flooded sections.
<image>
Assume that rain is falling endlessly in the region and the water overflowing from ... |
### Prompt
In Cpp, your task is to solve the following problem:
There exists an island called Arpa’s land, some beautiful girls live there, as ugly ones do.
Mehrdad wants to become minister of Arpa’s land. Arpa has prepared an exam. Exam has only one question, given n, print the last digit of 1378n.
<image>
Mehrd... |
### Prompt
Your task is to create a CPP solution to the following problem:
One way to create task is to learn from game. You should pick a game and focus on part of the mechanic of that game, then it might be a good task.
Let's have a try. Puzzle and Dragon was a popular game in Japan, we focus on the puzzle part of... |
### Prompt
Construct a cpp code solution to the problem outlined:
This problem is a little bit unusual. Here you are to implement an interaction with a testing system. That means that you can make queries and get responses in the online mode. Please be sure to use the stream flushing operation after each query's outp... |
### Prompt
Please create a solution in Cpp to the following problem:
You are given an array a[0 … n-1] of length n which consists of non-negative integers. Note that array indices start from zero.
An array is called good if the parity of each index matches the parity of the element at that index. More formally, an a... |
### Prompt
In Cpp, your task is to solve the following problem:
You are given a matrix n × m, initially filled with zeroes. We define a_{i, j} as the element in the i-th row and the j-th column of the matrix.
Two cells of the matrix are connected if they share a side, and the elements in these cells are equal. Two c... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Mashmokh works in a factory. At the end of each day he must turn off all of the lights.
The lights on the factory are indexed from 1 to n. There are n buttons in Mashmokh's room indexed from 1 to n as well. If Mashmokh pushes button with index i, the... |
### Prompt
Construct a Cpp code solution to the problem outlined:
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 se... |
### Prompt
Develop a solution in Cpp to the problem described below:
A number is called almost prime if it has exactly two distinct prime divisors. For example, numbers 6, 18, 24 are almost prime, while 4, 8, 9, 42 are not. Find the amount of almost prime numbers which are between 1 and n, inclusive.
Input
Input co... |
### Prompt
Your task is to create a Cpp solution to the following problem:
ZS the Coder loves mazes. Your job is to create one so that he can play with it. A maze consists of n × m rooms, and the rooms are arranged in n rows (numbered from the top to the bottom starting from 1) and m columns (numbered from the left t... |
### Prompt
In Cpp, your task is to solve the following problem:
problem
You are playing with J using the Midakuji. The Amida lottery consists of n vertical bars and m horizontal bars. The vertical bars are numbered from 1 to n in order from the left, and the vertical bar i The positive integer si is written at the b... |
### Prompt
Please create a solution in CPP to the following problem:
Every year, hundreds of people come to summer camps, they learn new algorithms and solve hard problems.
This is your first year at summer camp, and you are asked to solve the following problem. All integers starting with 1 are written in one line. ... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Firecrackers scare Nian the monster, but they're wayyyyy too noisy! Maybe fireworks make a nice complement.
Little Tommy is watching a firework show. As circular shapes spread across the sky, a splendid view unfolds on the night of Lunar ... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Sereja has two sequences a and b and number p. Sequence a consists of n integers a1, a2, ..., an. Similarly, sequence b consists of m integers b1, b2, ..., bm. As usual, Sereja studies the sequences he has. Today he wants to find the numbe... |
### Prompt
Create a solution in CPP for the following problem:
You have an array a_1, a_2, ..., a_n. All a_i are positive integers.
In one step you can choose three distinct indices i, j, and k (i ≠ j; i ≠ k; j ≠ k) and assign the sum of a_j and a_k to a_i, i. e. make a_i = a_j + a_k.
Can you make all a_i lower or ... |
### Prompt
Create a solution in CPP for the following problem:
Rng is going to a festival.
The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer.
Here, assume that the name of "a festival of s" is ... |
### Prompt
Develop a solution in CPP to the problem described below:
Due to the success of TWICE, JYP Entertainment has earned countless money and emerged as the biggest entertainment firm by market capitalization. Therefore, the boss, JYP, has decided to create a new nation and has appointed you to provide a design ... |
### Prompt
Please create a solution in CPP to the following problem:
One university has just found out about a sport programming contest called ACM ICPC v2.0. This contest doesn't differ much from the well-known ACM ICPC, for example, the participants are not allowed to take part in the finals more than two times. Ho... |
### Prompt
In cpp, your task is to solve the following problem:
D: Anipero 2012
Anipero Summer Live, commonly known as Anipero, is the largest anime song live event in Japan where various anime song artists gather. 2D, who loves anime songs, decided to go to Anipero this year as well as last year.
He has already pu... |
### Prompt
Construct a Cpp code solution to the problem outlined:
You are given a matrix with n rows (numbered from 1 to n) and m columns (numbered from 1 to m). A number a_{i, j} is written in the cell belonging to the i-th row and the j-th column, each number is either 0 or 1.
A chip is initially in the cell (1, 1... |
### Prompt
Please formulate a Cpp solution to the following problem:
John Doe has an n × m table. John Doe can paint points in some table cells, not more than one point in one table cell. John Doe wants to use such operations to make each square subtable of size n × n have exactly k points.
John Doe wondered, how ma... |
### Prompt
Develop a solution in cpp to the problem described below:
Once upon a time in the galaxy of far, far away...
Darth Wader found out the location of a rebels' base. Now he is going to destroy the base (and the whole planet that the base is located at), using the Death Star.
When the rebels learnt that the ... |
### Prompt
Please create a solution in cpp to the following problem:
Nathan O. Davis is trying to capture a game and struggling to get a very rare item. This rare item can be obtained by arranging special patterns in a row on a casino slot machine. The slot machine has N reels, and pressing the button once stops the ... |
### Prompt
Construct a CPP code solution to the problem outlined:
You are given two integers b and w. You have a chessboard of size 10^9 × 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on this chessboard that contains exactly b black cells and exa... |
### Prompt
Your task is to create a cpp solution to the following problem:
Let's call some square matrix with integer values in its cells palindromic if it doesn't change after the order of rows is reversed and it doesn't change after the order of columns is reversed.
For example, the following matrices are palindro... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
We have a string S consisting of uppercase English letters. Additionally, an integer N will be given.
Shift each character of S by N in alphabetical order (see below), and print the resulting string.
We assume that `A` follows `Z`. For e... |
### Prompt
In Cpp, your task is to solve the following problem:
Alice has a string consisting of characters 'A', 'B' and 'C'. Bob can use the following transitions on any substring of our string in any order any number of times:
* A <image> BC
* B <image> AC
* C <image> AB
* AAA <image> empty string
Not... |
### Prompt
Please create a solution in CPP to the following problem:
This is the easier version of the problem. In this version 1 ≤ n, m ≤ 100. You can hack this problem only if you solve and lock both problems.
You are given a sequence of integers a=[a_1,a_2,...,a_n] of length n. Its subsequence is obtained by remo... |
### Prompt
Please create a solution in Cpp to the following problem:
Example
Input
2 10 6
4 4 E
6 4 W
Output
2
### Response
```cpp
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <tuple>
using namespace std;
typedef pair<int, int> pii;
static const int IN... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Each student eagerly awaits the day he would pass the exams successfully. Thus, Vasya was ready to celebrate, but, alas, he didn't pass it. However, many of Vasya's fellow students from the same group were more successful and celebrated af... |
### Prompt
Your task is to create a cpp solution to the following problem:
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instea... |
### Prompt
Construct a cpp code solution to the problem outlined:
You're given a tree with n vertices. The color of the i-th vertex is h_{i}.
The value of the tree is defined as ∑_{h_{i} = h_{j}, 1 ≤ i < j ≤ n}{dis(i,j)}, where dis(i,j) is the number of edges on the shortest path between i and j.
The color of each... |
### Prompt
Develop a solution in Cpp to the problem described below:
n ants are on a circle of length m. An ant travels one unit of distance per one unit of time. Initially, the ant number i is located at the position si and is facing in the direction di (which is either L or R). Positions are numbered in countercloc... |
### Prompt
Develop a solution in cpp to the problem described below:
The hero of our story, Valera, and his best friend Arcady are still in school, and therefore they spend all the free time playing turn-based strategy "GAGA: Go And Go Again". The gameplay is as follows.
There are two armies on the playing field ea... |
### Prompt
Construct a cpp code solution to the problem outlined:
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the <image> remai... |
### Prompt
Generate a cpp solution to the following problem:
Given 2 integers u and v, find the shortest array such that [bitwise-xor](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) of its elements is u, and the sum of its elements is v.
Input
The only line contains 2 integers u and v (0 ≤ u,v ≤ 10^{18}).
Ou... |
### Prompt
In cpp, your task is to solve the following problem:
The life goes up and down, just like nice sequences. Sequence t1, t2, ..., tn is called nice if the following two conditions are satisfied:
* ti < ti + 1 for each odd i < n;
* ti > ti + 1 for each even i < n.
For example, sequences (2, 8), (1,... |
### Prompt
Please provide a cpp coded solution to the problem described below:
There is a country with n citizens. The i-th of them initially has a_{i} money. The government strictly controls the wealth of its citizens. Whenever a citizen makes a purchase or earns some money, they must send a receipt to the social se... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively.
An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at cons... |
### Prompt
Generate a Cpp solution to the following problem:
It is a balmy spring afternoon, and Farmer John's n cows are ruminating about link-cut cacti in their stalls. The cows, labeled 1 through n, are arranged so that the i-th cow occupies the i-th stall from the left. However, Elsie, after realizing that she wi... |
### Prompt
Generate a Cpp solution to the following problem:
Thought it is already the XXI century, the Mass Media isn't very popular in Walrusland. The cities get news from messengers who can only travel along roads. The network of roads in Walrusland is built so that it is possible to get to any city from any other... |
### Prompt
Create a solution in cpp for the following problem:
Limak is an old brown bear. He often goes bowling with his friends. Today he feels really good and tries to beat his own record!
For rolling a ball one gets a score — an integer (maybe negative) number of points. Score for i-th roll is multiplied by i an... |
### Prompt
Please create a solution in Cpp to the following problem:
The stardate is 1983, and Princess Heidi is getting better at detecting the Death Stars. This time, two Rebel spies have yet again given Heidi two maps with the possible locations of the Death Star. Since she got rid of all double agents last time, ... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
You are a paparazzi working in Manhattan.
Manhattan has r south-to-north streets, denoted by numbers 1, 2,…, r in order from west to east, and r west-to-east streets, denoted by numbers 1,2,…,r in order from south to north. Each of the r ... |
### Prompt
Generate a CPP solution to the following problem:
Boy Dima gave Julian a birthday present — set B consisting of positive integers. However, he didn't know, that Julian hates sets, but enjoys bipartite graphs more than anything else!
Julian was almost upset, but her friend Alex said, that he can build an u... |
### Prompt
Please formulate 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 string of leng... |
### Prompt
Create a solution in CPP for the following problem:
You are given an undirected tree consisting of n vertices. An undirected tree is a connected undirected graph with n - 1 edges.
Your task is to add the minimum number of edges in such a way that the length of the shortest path from the vertex 1 to any ot... |
### Prompt
In CPP, your task is to solve the following problem:
Alexey recently held a programming contest for students from Berland. n students participated in a contest, i-th of them solved ai problems. Now he wants to award some contestants. Alexey can award the students with diplomas of three different degrees. E... |
### Prompt
Your task is to create a Cpp solution to the following problem:
A string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:
* S is a palindrome.
* Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is... |
### Prompt
In Cpp, your task is to solve the following problem:
You are given a text consisting of n space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after the last word. The length of text is the number of letters ... |
### Prompt
Develop a solution in Cpp to the problem described below:
Description
KULASIS is the name of a system developed and operated by the Higher Education Research and Development Promotion Organization for the purpose of providing information on common subjects throughout the university on the Web, supporting ... |
### Prompt
Please formulate a cpp solution to the following problem:
When Mr. Kay was browsing a certain SNS as usual, the problem that "there are people who can solve IQ150 or more" came to the timeline. Mr. Kay has an IQ of over 150, so he solved the problem in an instant without even looking at it. For him, he doe... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Snuke has a string x of length N. Initially, every character in x is `0`.
Snuke can do the following two operations any number of times in any order:
* Choose A consecutive characters in x and replace each of them with `0`.
* Choose B co... |
### Prompt
Please create a solution in Cpp to the following problem:
The only difference between easy and hard versions is the length of the string.
You are given a string s and a string t, both consisting only of lowercase Latin letters. It is guaranteed that t can be obtained from s by removing some (possibly, zer... |
### 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:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, su... |
### Prompt
Create a solution in cpp for the following problem:
Inna loves sweets very much. That's why she decided to play a game called "Sweet Matrix".
Inna sees an n × m matrix and k candies. We'll index the matrix rows from 1 to n and the matrix columns from 1 to m. We'll represent the cell in the i-th row and j-... |
### Prompt
Please formulate a CPP solution to the following problem:
Let's call a number k-good if it contains all digits not exceeding k (0, ..., k). You've got a number k and an array a containing n numbers. Find out how many k-good numbers are in a (count each number every time it occurs in array a).
Input
The f... |
### Prompt
Your task is to create a cpp solution to the following problem:
Polycarp's phone book contains n phone numbers, each of them is described by s_i — the number itself and m_i — the number of times Polycarp dials it in daily.
Polycarp has just bought a brand new phone with an amazing speed dial feature! More... |
### Prompt
In CPP, your task is to solve the following problem:
A permutation p of size n is an array such that every integer from 1 to n occurs exactly once in this array.
Let's call a permutation an almost identity permutation iff there exist at least n - k indices i (1 ≤ i ≤ n) such that pi = i.
Your task is to ... |
### Prompt
Please formulate a cpp solution to the following problem:
Description
THE BY DOLM @ STER is a training simulation game scheduled to be released on EXIDNA by 1rem on April 1, 2010. For the time being, it probably has nothing to do with an arcade game where the network connection service stopped earlier thi... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
The board has got a painted tree graph, consisting of n nodes. Let us remind you that a non-directed graph is called a tree if it is connected and doesn't contain any cycles.
Each node of the graph is painted black or white in such a mann... |
### Prompt
Develop a solution in CPP to the problem described below:
Square1001 has seen an electric bulletin board displaying the integer 1. He can perform the following operations A and B to change this value:
* Operation A: The displayed value is doubled.
* Operation B: The displayed value increases by K.
Squa... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Little Johnny has recently learned about set theory. Now he is studying binary relations. You've probably heard the term "equivalence relation". These relations are very important in many areas of mathematics. For example, the equality of ... |
### Prompt
Please formulate a CPP solution to the following problem:
There are n piles of stones, where the i-th pile has a_i stones. Two people play a game, where they take alternating turns removing stones.
In a move, a player may remove a positive number of stones from the first non-empty pile (the pile with the ... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Ostap already settled down in Rio de Janiero suburb and started to grow a tree in his garden. Recall that a tree is a connected undirected acyclic graph.
Ostap's tree now has n vertices. He wants to paint some vertices of the tree black such that fro... |
### Prompt
Your task is to create a Cpp solution to the following problem:
A lot of people associate Logo programming language with turtle graphics. In this case the turtle moves along the straight line and accepts commands "T" ("turn around") and "F" ("move 1 unit forward").
You are given a list of commands that wi... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Nikita has a stack. A stack in this problem is a data structure that supports two operations. Operation push(x) puts an integer x on the top of the stack, and operation pop() deletes the top integer from the stack, i. e. the last added. If... |
### Prompt
In cpp, your task is to solve the following problem:
There is a weighted tree with n nodes and n-1 edges. The nodes are conveniently labeled from 1 to n. The weights are positive integers at most 100. Define the distance between two nodes to be the sum of edges on the unique path between the nodes. You wou... |
### Prompt
Develop a solution in Cpp to the problem described below:
Background
The kindergarten attached to the University of Aizu is a kindergarten where children who love programming gather. Yu, one of the kindergarten children, loves rectangular blocks as much as programming. Yu-kun has been enthusiastic about m... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Konrad is a Human Relations consultant working for VoltModder, a large electrical equipment producer. Today, he has been tasked with evaluating the level of happiness in the company.
There are n people working for VoltModder, numbered from 1 ... |
### Prompt
Create a solution in Cpp for the following problem:
Celebrating the new year, many people post videos of falling dominoes; Here's a list of them: https://www.youtube.com/results?search_query=New+Years+Dominos
User ainta, who lives in a 2D world, is going to post a video as well.
There are n dominoes on a... |
### Prompt
Develop a solution in Cpp to the problem described below:
Alice and Bob are playing a game with n piles of stones. It is guaranteed that n is an even number. The i-th pile has a_i stones.
Alice and Bob will play a game alternating turns with Alice going first.
On a player's turn, they must choose exactly... |
### Prompt
Construct a cpp code solution to the problem outlined:
Dima came to the horse land. There are n horses living in the land. Each horse in the horse land has several enemies (enmity is a symmetric relationship). The horse land isn't very hostile, so the number of enemies of each horse is at most 3.
Right no... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
One day, ZS the Coder wrote down an array of integers a with elements a1, a2, ..., an.
A subarray of the array a is a sequence al, al + 1, ..., ar for some integers (l, r) such that 1 ≤ l ≤ r ≤ n. ZS the Coder thinks that a subarray of a ... |
### Prompt
Please create a solution in cpp to the following problem:
You are given an integer n.
You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times:
1. Replace n with n/2 if n is divisible by 2;
2. Replace n with 2n/3 if n is divisible by 3;
3. Re... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Given two non-negative decimal integers $a$ and $b$, calculate their AND (logical conjunction), OR (logical disjunction) and XOR (exclusive disjunction) and print them in binary representation of 32 bits.
Constraints
* $0 \leq a, b \leq ... |
### Prompt
Develop a solution in cpp to the problem described below:
There are N squares numbered 1 to N from left to right. Each square has a character written on it, and Square i has a letter s_i. Besides, there is initially one golem on each square.
Snuke cast Q spells to move the golems.
The i-th spell consiste... |
### Prompt
Please formulate a CPP solution to the following problem:
Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much harder.
Let's... |
### Prompt
Generate a cpp solution to the following problem:
Broken crypto generator
JAG (Japanese Alumni Group) is a mysterious organization composed of many programmers, and in order to enter the building where the headquarters of this organization is located, it is necessary to solve the ciphertext generated by a... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Fox Ciel is playing a card game with her friend Fox Jiro. There are n piles of cards on the table. And there is a positive integer on each card.
The players take turns and Ciel takes the first turn. In Ciel's turn she takes a card from th... |
### Prompt
Construct a Cpp code solution to the problem outlined:
The finalists of the "Russian Code Cup" competition in 2214 will be the participants who win in one of the elimination rounds.
The elimination rounds are divided into main and additional. Each of the main elimination rounds consists of c problems, the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.