question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
Carl is a beginner magician. He has a blue, b violet and c orange magic spheres. In one move he can transform two spheres of the same color into one sphere of any other color. To make a spell that has never been seen before, he needs at least x blue, y ... |
Solve the programming task below in a Python markdown code block.
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go ... |
Solve the programming task below in a Python markdown code block.
How many infinite sequences a_1, a_2, ... consisting of {{1, ... ,n}} satisfy the following conditions?
- The n-th and subsequent elements are all equal. That is, if n \leq i,j, a_i = a_j.
- For every integer i, the a_i elements immediately following ... |
Solve the programming task below in a Python markdown code block.
Tanya wants to go on a journey across the cities of Berland. There are $n$ cities situated along the main railroad line of Berland, and these cities are numbered from $1$ to $n$.
Tanya plans her journey as follows. First of all, she will choose some c... |
Solve the programming task below in a Python markdown code block.
There are n wizards. They are numbered from 1 to n, and the i-th wizard has the magical power ri (1 ≤ i ≤ n). Now they are confronting a powerful wizard, whose enemy's magical power is S. n Wizards are good at fighting together, especially two people. W... |
Solve the programming task below in a Python markdown code block.
Sereja has a bracket sequence s_1, s_2, ..., s_{n}, or, in other words, a string s of length n, consisting of characters "(" and ")".
Sereja needs to answer m queries, each of them is described by two integers l_{i}, r_{i} (1 ≤ l_{i} ≤ r_{i} ≤ n). The ... |
Solve the programming task below in a Python markdown code block.
You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order:
- Choose two among A, B and C, then increase both by 1.
-... |
Solve the programming task below in a Python markdown code block.
For building the encrypted string:Take every 2nd char from the string, then the other chars, that are not every 2nd char, and concat them as new String.
Do this n times!
Examples:
```
"This is a test!", 1 -> "hsi etTi sats!"
"This is a test!", 2 -> "h... |
Solve the programming task below in a Python markdown code block.
Andrewid the Android is a galaxy-famous detective. He is now chasing a criminal hiding on the planet Oxa-5, the planet almost fully covered with water.
The only dry land there is an archipelago of n narrow islands located in a row. For more comfort let... |
Solve the programming task below in a Python markdown code block.
There are $n$ pillars aligned in a row and numbered from $1$ to $n$.
Initially each pillar contains exactly one disk. The $i$-th pillar contains a disk having radius $a_i$.
You can move these disks from one pillar to another. You can take a disk from ... |
Solve the programming task below in a Python markdown code block.
Let's call a set of positive integers a_1, a_2, ..., a_k quadratic if the product of the factorials of its elements is a square of an integer, i. e. ∏_{i=1}^{k} a_i! = m^2, for some integer m.
You are given a positive integer n.
Your task is to find a... |
Solve the programming task below in a Python markdown code block.
# Task
In ChessLand there is a small but proud chess bishop with a recurring dream.
In the dream the bishop finds itself on an `n × m` chessboard with mirrors along each edge, and it is not a bishop but a ray of light. This ray of light moves only ... |
Solve the programming task below in a Python markdown code block.
Devu is a dumb guy, his learning curve is very slow. You are supposed to teach him n subjects, the i^{th} subject has c_{i} chapters. When you teach him, you are supposed to teach all the chapters of a subject continuously.
Let us say that his initial ... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese and Russian.
Spring is interesting season of year. Chef is thinking about different things, but last time he thinks about interesting game - "Strange Matrix".
Chef has a matrix that consists of n rows, eac... |
Solve the programming task below in a Python markdown code block.
Little Dima has two sequences of points with integer coordinates: sequence (a_1, 1), (a_2, 2), ..., (a_{n}, n) and sequence (b_1, 1), (b_2, 2), ..., (b_{n}, n).
Now Dima wants to count the number of distinct sequences of points of length 2·n that can b... |
Solve the programming task below in a Python markdown code block.
Theofanis really likes sequences of positive integers, thus his teacher (Yeltsa Kcir) gave him a problem about a sequence that consists of only special numbers.
Let's call a positive number special if it can be written as a sum of different non-negativ... |
Solve the programming task below in a Python markdown code block.
You have decided to give an allowance to your child depending on the outcome of the game that he will play now.
The game is played as follows:
- There are three "integer panels", each with a digit between 1 and 9 (inclusive) printed on it, and one "ope... |
Solve the programming task below in a Python markdown code block.
Levian works as an accountant in a large company. Levian knows how much the company has earned in each of the n consecutive months — in the i-th month the company had income equal to a_i (positive income means profit, negative income means loss, zero in... |
Solve the programming task below in a Python markdown code block.
A breakthrough among computer games, "Civilization XIII", is striking in its scale and elaborate details. Let's take a closer look at one of them.
The playing area in the game is split into congruent cells that are regular hexagons. The side of each ce... |
Solve the programming task below in a Python markdown code block.
You have $N$ items that you want to put them into a knapsack. Item $i$ has value $v_i$, weight $w_i$ and limitation $m_i$.
You want to find a subset of items to put such that:
* The total value of the items is as large as possible.
* The items have co... |
Solve the programming task below in a Python markdown code block.
One day a highly important task was commissioned to Vasya — writing a program in a night. The program consists of n lines of code. Vasya is already exhausted, so he works like that: first he writes v lines of code, drinks a cup of tea, then he writes as... |
Solve the programming task below in a Python markdown code block.
It's bonus time in the big city! The fatcats are rubbing their paws in anticipation... but who is going to make the most money?
Build a function that takes in two arguments (salary, bonus). Salary will be an integer, and bonus a boolean.
If bonus is ... |
Solve the programming task below in a Python markdown code block.
Polycarp lives on the coordinate axis $Ox$ and travels from the point $x=a$ to $x=b$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.
On the axis $Ox$ at the point $x=c$ the base station of the mobile operator is placed.... |
Solve the programming task below in a Python markdown code block.
You are given a string $s$ consisting of lowercase Latin letters and $q$ queries for this string.
Recall that the substring $s[l; r]$ of the string $s$ is the string $s_l s_{l + 1} \dots s_r$. For example, the substrings of "codeforces" are "code", "fo... |
Solve the programming task below in a Python markdown code block.
Taro Aizu's company has a boss who hates being indivisible. When Taro goes out to eat with his boss, he pays by splitting the bill, but when the payment amount is not divisible by the number of participants, his boss always pays for it.
One day, Taro b... |
Solve the programming task below in a Python markdown code block.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, each with a single uppercase or lowercase alphabetic name (... |
Solve the programming task below in a Python markdown code block.
Professor GukiZ makes a new robot. The robot are in the point with coordinates (x_1, y_1) and should go to the point (x_2, y_2). In a single step the robot can change any of its coordinates (maybe both of them) by one (decrease or increase). So the robo... |
Solve the programming task below in a Python markdown code block.
Given an array of numbers, return a string made up of four parts:
a) a four character 'word', made up of the characters derived from the first two and last two numbers in the array. order should be as read left to right (first, second, second last, las... |
Solve the programming task below in a Python markdown code block.
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_2 (... |
Solve the programming task below in a Python markdown code block.
One day Nikita found the string containing letters "a" and "b" only.
Nikita thinks that string is beautiful if it can be cut into 3 strings (possibly empty) without changing the order of the letters, where the 1-st and the 3-rd one contain only letter... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese and Russian.
The following is an easy game that the setter of this problem played when he was 8:
A boatman, a wolf, a sheep, and a cabbage are on the bank of a river. They have a small boat that is capabl... |
Solve the programming task below in a Python markdown code block.
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows that each of the messages is an archive containing one or ... |
Solve the programming task below in a Python markdown code block.
There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is h_{i} meters, distinct planks can have distinct heights. [Image] Fence for n ... |
Solve the programming task below in a Python markdown code block.
You are given an array a_1, a_2, ..., a_n and an array b_1, b_2, ..., b_n.
For one operation you can sort in non-decreasing order any subarray a[l ... r] of the array a.
For example, if a = [4, 2, 2, 1, 3, 1] and you choose subbarray a[2 ... 5], then ... |
Solve the programming task below in a Python markdown code block.
Two players play a game.
Initially there are $n$ integers $a_1, a_2, \ldots, a_n$ written on the board. Each turn a player selects one number and erases it from the board. This continues until there is only one number left on the board, i. e. $n - 1$ t... |
Solve the programming task below in a Python markdown code block.
First-rate specialists graduate from Berland State Institute of Peace and Friendship. You are one of the most talented students in this university. The education is not easy because you need to have fundamental knowledge in different areas, which someti... |
Solve the programming task below in a Python markdown code block.
An ant moves on the real line with constant speed of $1$ unit per second. It starts at $0$ and always moves to the right (so its position increases by $1$ each second).
There are $n$ portals, the $i$-th of which is located at position $x_i$ and telepor... |
Solve the programming task below in a Python markdown code block.
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 to ... |
Solve the programming task below in a Python markdown code block.
Ksusha is a beginner coder. Today she starts studying arrays. She has array a_1, a_2, ..., a_{n}, consisting of n positive integers.
Her university teacher gave her a task. Find such number in the array, that all array elements are divisible by it. Hel... |
Solve the programming task below in a Python markdown code block.
Someone gave Alyona an array containing n positive integers a_1, a_2, ..., a_{n}. In one operation, Alyona can choose any element of the array and decrease it, i.e. replace with any positive integer that is smaller than the current one. Alyona can repea... |
Solve the programming task below in a Python markdown code block.
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 beaut... |
Solve the programming task below in a Python markdown code block.
Chuck has lost count of how many asses he has kicked...
Chuck stopped counting at 100,000 because he prefers to kick things in the face instead of counting. That's just who he is.
To stop having to count like a mere mortal chuck developed his own spec... |
Solve the programming task below in a Python markdown code block.
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; R stands for red and W stands for white.
You can do the following two kinds of operations a... |
Solve the programming task below in a Python markdown code block.
While playing with geometric figures Alex has accidentally invented a concept of a $n$-th order rhombus in a cell grid.
A $1$-st order rhombus is just a square $1 \times 1$ (i.e just a cell).
A $n$-th order rhombus for all $n \geq 2$ one obtains from ... |
Solve the programming task below in a Python markdown code block.
Tired of boring office work, Denis decided to open a fast food restaurant.
On the first day he made $a$ portions of dumplings, $b$ portions of cranberry juice and $c$ pancakes with condensed milk.
The peculiarity of Denis's restaurant is the procedure... |
Solve the programming task below in a Python markdown code block.
M-kun is a brilliant air traffic controller.
On the display of his radar, there are N airplanes numbered 1, 2, ..., N, all flying at the same altitude.
Each of the airplanes flies at a constant speed of 0.1 per second in a constant direction. The curre... |
Solve the programming task below in a Python markdown code block.
Shell Sort
Shell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.
1 insertionSort(A, n, g)
2 for i = g to n-1
3 v = A[i]
4 j = i - g
5 while j >= 0 && A[j] > v
6 A[j+g] = ... |
Solve the programming task below in a Python markdown code block.
Monocarp is playing a computer game. In this game, his character fights different monsters.
A fight between a character and a monster goes as follows. Suppose the character initially has health $h_C$ and attack $d_C$; the monster initially has health $... |
Solve the programming task below in a Python markdown code block.
The Queen of England has n trees growing in a row in her garden. At that, the i-th (1 ≤ i ≤ n) tree from the left has height a_{i} meters. Today the Queen decided to update the scenery of her garden. She wants the trees' heights to meet the condition: f... |
Solve the programming task below in a Python markdown code block.
VK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorithm selects a_i publications.
The latest A/B test sugg... |
Solve the programming task below in a Python markdown code block.
You are given three strings A, B and C. Check whether they form a word chain.
More formally, determine whether both of the following are true:
- The last character in A and the initial character in B are the same.
- The last character in B and the ini... |
Solve the programming task below in a Python markdown code block.
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 career. H... |
Solve the programming task below in a Python markdown code block.
# Task
Elections are in progress!
Given an array of numbers representing votes given to each of the candidates, and an integer which is equal to the number of voters who haven't cast their vote yet, find the number of candidates who still have a chanc... |
Solve the programming task below in a Python markdown code block.
**Getting Familiar:**
LEET: (sometimes written as "1337" or "l33t"), also known as eleet or leetspeak, is another alphabet for the English language that is used mostly on the internet. It uses various combinations of ASCII characters to replace Latinate... |
Solve the programming task below in a Python markdown code block.
Our Chef is catering for a big corporate office party and is busy preparing different mouth watering dishes. The host has insisted that he serves his delicious cupcakes for dessert.
On the day of the party, the Chef was over-seeing all the food arrang... |
Solve the programming task below in a Python markdown code block.
You're looking through different hex codes, and having trouble telling the difference between #000001 and #100000
We need a way to tell which is red, and which is blue!
That's where you create ```hex_color()```!
It should read an RGB input, and r... |
Solve the programming task below in a Python markdown code block.
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.
One day Petya encountered a tree ... |
Solve the programming task below in a Python markdown code block.
Lenny is playing a game on a 3 × 3 grid of lights. In the beginning of the game all lights are switched on. Pressing any of the lights will toggle it and all side-adjacent lights. The goal of the game is to switch all the lights off. We consider the tog... |
Solve the programming task below in a Python markdown code block.
problem
The island where JOI lives has been invaded by zombies. JOI decided to escape to the shelter, which is set as the safest shelter on the island.
The island where JOI lives consists of N towns from town 1 to town N, and the towns are connected b... |
Solve the programming task below in a Python markdown code block.
Vasya decided to go to the grocery store. He found in his wallet $a$ coins of $1$ burle and $b$ coins of $2$ burles. He does not yet know the total cost of all goods, so help him find out $s$ ($s > 0$): the minimum positive integer amount of money he ca... |
Solve the programming task below in a Python markdown code block.
You have a digit sequence S of length 4. You are wondering which of the following formats S is in:
- YYMM format: the last two digits of the year and the two-digit representation of the month (example: 01 for January), concatenated in this order
- MMY... |
Solve the programming task below in a Python markdown code block.
This program tests the life of an
evaporator containing a gas.
We know the content of the evaporator (content in ml),
the percentage of foam or gas lost every day (evap_per_day)
and the threshold (threshold) in percentage beyond which
the evaporator i... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese and Russian.
Rupsa recently started to intern under Chef. He gave her N type of ingredients of varying quantity A_{1}, A_{2}, ..., A_{N} respectively to store it. But as she is lazy to arrange them she pu... |
Solve the programming task below in a Python markdown code block.
In Republic of AtCoder, Snuke Chameleons (Family: Chamaeleonidae, Genus: Bartaberia) are very popular pets. Ringo keeps N Snuke Chameleons in a cage.
A Snuke Chameleon that has not eaten anything is blue. It changes its color according to the following... |
Solve the programming task below in a Python markdown code block.
According to a new ISO standard, a flag of every country should have a chequered field n × m, each square should be of one of 10 colours, and the flag should be «striped»: each horizontal row of the flag should contain squares of the same colour, and th... |
Solve the programming task below in a Python markdown code block.
After finishing eating her bun, Alyona came up with two integers n and m. She decided to write down two columns of integers — the first column containing integers from 1 to n and the second containing integers from 1 to m. Now the girl wants to count ho... |
Solve the programming task below in a Python markdown code block.
When you play the game of thrones, you win, or you die. There is no middle ground.
Cersei Lannister, A Game of Thrones by George R. R. Martin
There are n nobles, numbered from 1 to n. Noble i has a power of i. There are also m "friendships". A friends... |
Solve the programming task below in a Python markdown code block.
You are given strings $S$ and $T$, consisting of lowercase English letters. It is guaranteed that $T$ is a permutation of the string abc.
Find string $S'$, the lexicographically smallest permutation of $S$ such that $T$ is not a subsequence of $S'$.
S... |
Solve the programming task below in a Python markdown code block.
Create a program that calculates and outputs the surface distance by inputting the north latitude and east longitude of two cities on the earth. However, the earth is a sphere with a radius of 6,378.1 km, and the surface distance between two points is t... |
Solve the programming task below in a Python markdown code block.
Vova promised himself that he would never play computer games... But recently Firestorm — a well-known game developing company — published their newest game, World of Farcraft, and it became really popular. Of course, Vova started playing it.
Now he tr... |
Solve the programming task below in a Python markdown code block.
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N.
Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute differenc... |
Solve the programming task below in a Python markdown code block.
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $i$-th page contains some mystery that will be explained on page $a_i$ ($a_i \ge i$).
Iv... |
Solve the programming task below in a Python markdown code block.
In this kata, the number 0 is infected. You are given a list. Every turn, any item in the list that is adjacent to a 0 becomes infected and transforms into a 0. How many turns will it take for the whole list to become infected?
```
[0,1,1,0] ==> [0,0,0... |
Solve the programming task below in a Python markdown code block.
Let x be a string of length at least 1.
We will call x a good string, if for any string y and any integer k (k \geq 2), the string obtained by concatenating k copies of y is different from x.
For example, a, bbc and cdcdc are good strings, while aa, bbb... |
Solve the programming task below in a Python markdown code block.
problem
There is one bar-shaped candy with a length of N mm (where N is an even number). Two JOI officials decided to cut this candy into multiple pieces and divide them into a total of N / 2 mm. did.
For unknown reasons, this candy has different ease... |
Solve the programming task below in a Python markdown code block.
Kolya got an integer array $a_1, a_2, \dots, a_n$. The array can contain both positive and negative integers, but Kolya doesn't like $0$, so the array doesn't contain any zeros.
Kolya doesn't like that the sum of some subsegments of his array can be $0... |
Solve the programming task below in a Python markdown code block.
All cinema halls in Berland are rectangles with K rows of K seats each, and K is an odd number. Rows and seats are numbered from 1 to K. For safety reasons people, who come to the box office to buy tickets, are not allowed to choose seats themselves. Fo... |
Solve the programming task below in a Python markdown code block.
It's hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy to Petya, but he thinks he lacks time to finish them all, so he asks you to help with one..
There is a glob pattern in the statements (a string consisti... |
Solve the programming task below in a Python markdown code block.
Alice and Bob like games. And now they are ready to start a new game. They have placed n chocolate bars in a line. Alice starts to eat chocolate bars one by one from left to right, and Bob — from right to left. For each chocololate bar the time, needed ... |
Solve the programming task below in a Python markdown code block.
From "ftying rats" to urban saniwation workers - can synthetic biology tronsform how we think of pigeons?
The upiquitous pigeon has long been viewed as vermin - spleading disease, scavenging through trush, and defecating in populous urban spases. Yet ... |
Solve the programming task below in a Python markdown code block.
Given is an integer sequence of length N: A_1, A_2, \cdots, A_N.
An integer sequence X, which is also of length N, will be chosen randomly by independently choosing X_i from a uniform distribution on the integers 1, 2, \ldots, A_i for each i (1 \leq i \... |
Solve the programming task below in a Python markdown code block.
Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different sec... |
Solve the programming task below in a Python markdown code block.
The only difference between easy and hard versions is the number of elements in the array.
You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you c... |
Solve the programming task below in a Python markdown code block.
The courier charges for a courier company are set according to size and weight as shown in the table below.
A size | B size | C size | D size | E size | F size
--- | --- | --- | --- | --- | --- | ---
Size | 60 cm or less | 80 cm or less | 100 cm or les... |
Solve the programming task below in a Python markdown code block.
Carving the cake 2 (Cake 2)
JOI-kun and IOI-chan are twin brothers and sisters. JOI has been enthusiastic about making sweets lately, and JOI tried to bake a cake and eat it today, but when it was baked, IOI who smelled it came, so we decided to divide... |
Solve the programming task below in a Python markdown code block.
In this Kata, we are going to determine if the count of each of the characters in a string can be equal if we remove a single character from that string.
For example:
```
solve('abba') = false -- if we remove any character, the count of each character ... |
Solve the programming task below in a Python markdown code block.
Vlad likes to eat in cafes very much. During his life, he has visited cafes n times. Unfortunately, Vlad started to feel that his last visits are not any different from each other. To fix that Vlad had a small research.
First of all, Vlad assigned indi... |
Solve the programming task below in a Python markdown code block.
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right... |
Solve the programming task below in a Python markdown code block.
The Two-dimensional kingdom is going through hard times... This morning the Three-Dimensional kingdom declared war on the Two-dimensional one. This (possibly armed) conflict will determine the ultimate owner of the straight line.
The Two-dimensional ki... |
Solve the programming task below in a Python markdown code block.
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with ... |
Solve the programming task below in a Python markdown code block.
There are $n$ students standing in a row. Two coaches are forming two teams — the first coach chooses the first team and the second coach chooses the second team.
The $i$-th student has integer programming skill $a_i$. All programming skills are distin... |
Solve the programming task below in a Python markdown code block.
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions:
- Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9).
- The number of matchsticks used to form digits 1, 2... |
Solve the programming task below in a Python markdown code block.
# Scenario
With **_Cereal crops_** like wheat or rice, before we can eat the grain kernel, we need to remove that inedible hull, or *to separate the wheat from the chaff*.
___
# Task
**_Given_** a *sequence of n integers* , **_separate_** *the negat... |
Solve the programming task below in a Python markdown code block.
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 consecutive char... |
Solve the programming task below in a Python markdown code block.
Problem
Taro decided to watch one movie every day at a nearby movie theater during the summer vacation. (Taro has 31 days of summer vacation from August 1st to August 31st.)
The theater is set to show n movies during the summer vacation. Each movie is... |
Solve the programming task below in a Python markdown code block.
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. b_{i} ≥ 2. b is pairwise coprime: for every 1 ≤ i < j ≤ n, b_{i} and b_{j} are c... |
Solve the programming task below in a Python markdown code block.
You are given two positive integers ```a``` and ```b```.
You can perform the following operations on ```a``` so as to obtain ```b``` :
```
(a-1)/2 (if (a-1) is divisible by 2)
a/2 (if a is divisible by 2)
a*2
```
```b``` will always be a power ... |
Solve the programming task below in a Python markdown code block.
Dreamoon likes sequences very much. So he created a problem about the sequence that you can't find in OEIS:
You are given two integers d, m, find the number of arrays a, satisfying the following constraints:
* The length of a is n, n ≥ 1
* 1 ≤ a... |
Solve the programming task below in a Python markdown code block.
Welcome to PC Koshien, players. Physical condition management is important to participate in the event. It is said that at the turn of the season when the temperature fluctuates greatly, it puts a strain on the body and it is easy to catch a cold. The d... |
Solve the programming task below in a Python markdown code block.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.