question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
Polycarp found $n$ segments on the street. A segment with the index $i$ is described by two integers $l_i$ and $r_i$ — coordinates of the beginning and end of the segment, respectively. Polycarp realized that he didn't need all the segments, so he wante... |
Solve the programming task below in a Python markdown code block.
The Smart Beaver from ABBYY was offered a job of a screenwriter for the ongoing TV series. In particular, he needs to automate the hard decision: which main characters will get married by the end of the series.
There are n single men and n single women... |
Solve the programming task below in a Python markdown code block.
Boboniu has a directed graph with n vertices and m edges.
The out-degree of each vertex is at most k.
Each edge has an integer weight between 1 and m. No two edges have equal weights.
Boboniu likes to walk on the graph with some specific rules, which... |
Solve the programming task below in a Python markdown code block.
The only difference between easy and hard versions is the constraints.
Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $n$ consecutive pictures (with kittens, of course). Vova likes all th... |
Solve the programming task below in a Python markdown code block.
Chouti is working on a strange math problem.
There was a sequence of $n$ positive integers $x_1, x_2, \ldots, x_n$, where $n$ is even. The sequence was very special, namely for every integer $t$ from $1$ to $n$, $x_1+x_2+...+x_t$ is a square of some in... |
Solve the programming task below in a Python markdown code block.
In this Kata, you will be given a list of strings and your task will be to find the strings that have the same characters and return the sum of their positions as follows:
```Haskell
solve(["abc","abbc", "ab", "xyz", "xy", "zzyx"]) = [1,8]
-- we see t... |
Solve the programming task below in a Python markdown code block.
The 9-th grade student Gabriel noticed a caterpillar on a tree when walking around in a forest after the classes. The caterpillar was on the height h_1 cm from the ground. On the height h_2 cm (h_2 > h_1) on the same tree hung an apple and the caterpill... |
Solve the programming task below in a Python markdown code block.
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.
Polycarpus continues working as a system administrator in a large corporation. The computer ... |
Solve the programming task below in a Python markdown code block.
Some natural number was written on the board. Its sum of digits was not less than k. But you were distracted a bit, and someone changed this number to n, replacing some digits with others. It's known that the length of the number didn't change.
You hav... |
Solve the programming task below in a Python markdown code block.
Write a program of a Merge Sort algorithm implemented by the following pseudocode. You should also report the number of comparisons in the Merge function.
Merge(A, left, mid, right)
n1 = mid - left;
n2 = right - mid;
create array L[0...n1], R[0...n2]
... |
Solve the programming task below in a Python markdown code block.
You are given a positive integer $x$. Check whether the number $x$ is representable as the sum of the cubes of two positive integers.
Formally, you need to check if there are two integers $a$ and $b$ ($1 \le a, b$) such that $a^3+b^3=x$.
For example, ... |
Solve the programming task below in a Python markdown code block.
You are playing a new computer game in which you have to fight monsters. In a dungeon you are trying to clear, you met three monsters; the first of them has $a$ health points, the second has $b$ health points, and the third has $c$.
To kill the monster... |
Solve the programming task below in a Python markdown code block.
A festival will be held in a town's main street. There are n sections in the main street. The sections are numbered 1 through n from left to right. The distance between each adjacent sections is 1.
In the festival m fireworks will be launched. The i-th... |
Solve the programming task below in a Python markdown code block.
The new generation external memory contains an array of integers $a[1 \ldots n] = [a_1, a_2, \ldots, a_n]$.
This type of memory does not support changing the value of an arbitrary element. Instead, it allows you to cut out any segment of the given arra... |
Solve the programming task below in a Python markdown code block.
During the lesson small girl Alyona works with one famous spreadsheet computer program and learns how to edit tables.
Now she has a table filled with integers. The table consists of n rows and m columns. By a_{i}, j we will denote the integer located a... |
Solve the programming task below in a Python markdown code block.
You are given two integers $x$ and $y$ (it is guaranteed that $x > y$). You may choose any prime integer $p$ and subtract it any number of times from $x$. Is it possible to make $x$ equal to $y$?
Recall that a prime number is a positive integer that ha... |
Solve the programming task below in a Python markdown code block.
In 2300, the Life Science Division of Federal Republic of Space starts a very ambitious project to complete the genome sequencing of all living creatures in the entire universe and develop the genomic database of all space life. Thanks to scientific res... |
Solve the programming task below in a Python markdown code block.
qd ucyhf yi q fhycu dkcruh mxeiu huluhiu yi q tyvvuhudj fhycu dkcruh. oekh jqia yi je vydt jxu djx ucyhf.
Input
jxu ydfkj sediyiji ev q iydwbu ydjuwuh d (1 ≤ d ≤ 11184) — jxu edu-rqiut ydtun ev jxu ucyhf je vydt.
Output
ekjfkj q iydwbu dkcruh.
Exam... |
Solve the programming task below in a Python markdown code block.
You are given a string S consisting of lowercase English letters.
Determine whether we can turn S into a palindrome by repeating the operation of swapping two adjacent characters. If it is possible, find the minimum required number of operations.
-----... |
Solve the programming task below in a Python markdown code block.
Omkar and Akmar are playing a game on a circular board with n (2 ≤ n ≤ 10^6) cells. The cells are numbered from 1 to n so that for each i (1 ≤ i ≤ n-1) cell i is adjacent to cell i+1 and cell 1 is adjacent to cell n. Initially, each cell is empty.
Omka... |
Solve the programming task below in a Python markdown code block.
The prime numbers are not regularly spaced. For example from `2` to `3` the gap is `1`.
From `3` to `5` the gap is `2`. From `7` to `11` it is `4`.
Between 2 and 50 we have the following pairs of 2-gaps primes:
`3-5, 5-7, 11-13, 17-19, 29-31, 41-43`
A ... |
Solve the programming task below in a Python markdown code block.
Iahub is so happy about inventing bubble sort graphs that he's staying all day long at the office and writing permutations. Iahubina is angry that she is no more important for Iahub. When Iahub goes away, Iahubina comes to his office and sabotage his re... |
Solve the programming task below in a Python markdown code block.
Write function alternateCase which switch every letter in string from upper to lower and from lower to upper.
E.g: Hello World -> hELLO wORLD
Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sampl... |
Solve the programming task below in a Python markdown code block.
Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.
At least how many sheets of paper does he need?
-----Constraints-----
- N is an integer.
- 1 \leq N \leq 100
-----Input-----... |
Solve the programming task below in a Python markdown code block.
Takahashi, Nakahashi and Hikuhashi have integers A, B and C, respectively. After repeating the following operation K times, find the integer Takahashi will get minus the integer Nakahashi will get:
* Each of them simultaneously calculate the sum of the... |
Solve the programming task below in a Python markdown code block.
You are given an integer N that has exactly four digits in base ten. How many times does `2` occur in the base-ten representation of N?
Constraints
* 1000 \leq N \leq 9999
Input
Input is given from Standard Input in the following format:
N
Outpu... |
Solve the programming task below in a Python markdown code block.
## Task
Given a positive integer as input, return the output as a string in the following format:
Each element, corresponding to a digit of the number, multiplied by a power of 10 in such a way that with the sum of these elements you can obtain the o... |
Solve the programming task below in a Python markdown code block.
You are given an integer number $n$. The following algorithm is applied to it:
if $n = 0$, then end algorithm; find the smallest prime divisor $d$ of $n$; subtract $d$ from $n$ and go to step $1$.
Determine the number of subtrations the algorithm... |
Solve the programming task below in a Python markdown code block.
Victor tries to write his own text editor, with word correction included. However, the rules of word correction are really strange.
Victor thinks that if a word contains two consecutive vowels, then it's kinda weird and it needs to be replaced. So the ... |
Solve the programming task below in a Python markdown code block.
Andrzej was given a task:
There are n jars with pills. In every jar there is a different type of pill and the amount of pills in each jar is infinite. One type of pill makes a person glow about 30 minutes after taking and none of the other types has any... |
Solve the programming task below in a Python markdown code block.
We make a tower by stacking up blocks. The tower consists of several stages and each stage is constructed by connecting blocks horizontally. Each block is of the same weight and is tough enough to withstand the weight equivalent to up to $K$ blocks with... |
Solve the programming task below in a Python markdown code block.
Decades have passed since the beginning of AtCoder Beginner Contest.
The contests are labeled as ABC001, ABC002, ... from the first round, but after the 999-th round ABC999, a problem occurred: how the future rounds should be labeled?
In the end, the la... |
Solve the programming task below in a Python markdown code block.
Berland National Library has recently been built in the capital of Berland. In addition, in the library you can take any of the collected works of Berland leaders, the library has a reading room.
Today was the pilot launch of an automated reading room ... |
Solve the programming task below in a Python markdown code block.
Emuskald is addicted to Codeforces, and keeps refreshing the main page not to miss any changes in the "recent actions" list. He likes to read thread conversations where each thread consists of multiple messages.
Recent actions shows a list of n differe... |
Solve the programming task below in a Python markdown code block.
The Little Elephant loves to play with color cards.
He has n cards, each has exactly two colors (the color of the front side and the color of the back side). Initially, all the cards lay on the table with the front side up. In one move the Little Eleph... |
Solve the programming task below in a Python markdown code block.
In order to make the "Sea Battle" game more interesting, Boris decided to add a new ship type to it. The ship consists of two rectangles. The first rectangle has a width of $w_1$ and a height of $h_1$, while the second rectangle has a width of $w_2$ and... |
Solve the programming task below in a Python markdown code block.
You are given a sequence $a_1, a_2, \dots, a_n$ consisting of $n$ non-zero integers (i.e. $a_i \ne 0$).
You have to calculate two following values: the number of pairs of indices $(l, r)$ $(l \le r)$ such that $a_l \cdot a_{l + 1} \dots a_{r - 1} \cd... |
Solve the programming task below in a Python markdown code block.
We will say that two integer sequences of length N, x_1, x_2, ..., x_N and y_1, y_2, ..., y_N, are similar when |x_i - y_i| \leq 1 holds for all i (1 \leq i \leq N).
In particular, any integer sequence is similar to itself.
You are given an integer N ... |
Solve the programming task below in a Python markdown code block.
One hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that the watermelon was weighed, and the scales showed w kilos. They rushed home, dying of thirst, and decided t... |
Solve the programming task below in a Python markdown code block.
Write a program which reads relations in a SNS (Social Network Service), and judges that given pairs of users are reachable each other through the network.
Constraints
* $2 \leq n \leq 100,000$
* $0 \leq m \leq 100,000$
* $1 \leq q \leq 10,000$
Input... |
Solve the programming task below in a Python markdown code block.
You are given an array a of size n, and q queries to it. There are queries of two types: 1 l_{i} r_{i} — perform a cyclic shift of the segment [l_{i}, r_{i}] to the right. That is, for every x such that l_{i} ≤ x < r_{i} new value of a_{x} + 1 becomes... |
Solve the programming task below in a Python markdown code block.
Lo and Behold! For you may be surprised by what our chief chef Noodle has in mind for this season! Today, Noodle announced one of his most extra-ordinary ideas ever - Project Spoon.
Noodle plans to deploy large spoons in the atmosphere so that people a... |
Solve the programming task below in a Python markdown code block.
There are two lists of different length. The first one consists of keys, the second one consists of values. Write a function ```createDict(keys, values)``` that returns a dictionary created from keys and values. If there are not enough values, the rest ... |
Solve the programming task below in a Python markdown code block.
You are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally "Seven-Five-Three numbers") are there?
Here, a Shichi-Go-San number is a positive integer that satisfies the following condition:
- Wh... |
Solve the programming task below in a Python markdown code block.
Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).
-----Constraints-----
- 1 \leq N \leq 10^5
-----Input-----
Input is given from Standard Input i... |
Solve the programming task below in a Python markdown code block.
To get on the Shinkansen, you need two tickets, a "ticket" and a "limited express ticket". These are separate tickets because some of the routes may not use the Shinkansen, but for routes that use only the Shinkansen, one ticket can be used as both a ti... |
Solve the programming task below in a Python markdown code block.
ICPC Calculator
In mathematics, we usually specify the order of operations by using parentheses. For example, 7 × (3 + 2) always means multiplying 7 by the result of 3 + 2 and never means adding 2 to the result of 7 × 3. However, there are people who d... |
Solve the programming task below in a Python markdown code block.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within distance bi inclu... |
Solve the programming task below in a Python markdown code block.
There are n cities and m bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter w. You can travel through the roads, but the governmen... |
Solve the programming task below in a Python markdown code block.
Mary wrote a recipe book and is about to publish it, but because of a new European law, she needs to update and include all measures in grams.
Given all the measures in tablespoon (`tbsp`) and in teaspoon (`tsp`), considering `1 tbsp = 15g` and `1 tsp ... |
Solve the programming task below in a Python markdown code block.
Colossal! — exclaimed Hawk-nose. — A programmer! That's exactly what we are looking for.Arkadi and Boris Strugatsky. Monday starts on Saturday
Reading the book "Equations of Mathematical Magic" Roman Oira-Oira and Cristobal Junta found an interesting e... |
Solve the programming task below in a Python markdown code block.
Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements.
```python
move_zeros([False,1,0,1,2,0,1,3,"a"]) # returns[False,1,1,2,1,3,"a",0,0]
```
Read the inputs from stdin solve the probl... |
Solve the programming task below in a Python markdown code block.
Snuke has a string S consisting of three kinds of letters: `a`, `b` and `c`.
He has a phobia for palindromes, and wants to permute the characters in S so that S will not contain a palindrome of length 2 or more as a substring. Determine whether this is... |
Solve the programming task below in a Python markdown code block.
Codefortia is a small island country located somewhere in the West Pacific. It consists of $n$ settlements connected by $m$ bidirectional gravel roads. Curiously enough, the beliefs of the inhabitants require the time needed to pass each road to be equa... |
Solve the programming task below in a Python markdown code block.
You are given a string $s$ consisting of lowercase Latin letters "a", "b" and "c" and question marks "?".
Let the number of question marks in the string $s$ be $k$. Let's replace each question mark with one of the letters "a", "b" and "c". Here we can ... |
Solve the programming task below in a Python markdown code block.
Given is a number sequence A of length N.
Find the number of integers i \left(1 \leq i \leq N\right) with the following property:
- For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.
-----Constraints-----
-... |
Solve the programming task below in a Python markdown code block.
Create a program that will take in a string as input and, if there are duplicates of more than two alphabetical characters in the string, returns the string with all the extra characters in a bracket.
For example, the input "aaaabbcdefffffffg" should r... |
Solve the programming task below in a Python markdown code block.
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j).
The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}.
You, a magical gir... |
Solve the programming task below in a Python markdown code block.
Berland shop sells $n$ kinds of juices. Each juice has its price $c_i$. Each juice includes some set of vitamins in it. There are three types of vitamins: vitamin "A", vitamin "B" and vitamin "C". Each juice can contain one, two or all three types of vi... |
Solve the programming task below in a Python markdown code block.
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 a_{i} candies in a box, that is given by... |
Solve the programming task below in a Python markdown code block.
Eighth-grader Vova is on duty today in the class. After classes, he went into the office to wash the board, and found on it the number n. He asked what is this number and the teacher of mathematics Inna Petrovna answered Vova that n is the answer to the... |
Solve the programming task below in a Python markdown code block.
You are given a number $k$ and a string $s$ of length $n$, consisting of the characters '.' and '*'. You want to replace some of the '*' characters with 'x' characters so that the following conditions are met:
The first character '*' in the original st... |
Solve the programming task below in a Python markdown code block.
Two T-shirt sizes are given: $a$ and $b$. The T-shirt size is either a string M or a string consisting of several (possibly zero) characters X and one of the characters S or L.
For example, strings M, XXL, S, XXXXXXXS could be the size of some T-shirts... |
Solve the programming task below in a Python markdown code block.
Ternary numeric notation is quite popular in Berland. To telegraph the ternary number the Borze alphabet is used. Digit 0 is transmitted as «.», 1 as «-.» and 2 as «--». You are to decode the Borze code, i.e. to find out the ternary number given its rep... |
Solve the programming task below in a Python markdown code block.
Adapted from here, with less terrible instructions and a couple tweaks.
Two kangaroos are jumping on a line. They start out at different points on the line, and jump in the same direction at different speeds. Your task is to determine whether or not th... |
Solve the programming task below in a Python markdown code block.
You are given an array $a$ of length $n$ and array $b$ of length $m$ both consisting of only integers $0$ and $1$. Consider a matrix $c$ of size $n \times m$ formed by following rule: $c_{i, j} = a_i \cdot b_j$ (i.e. $a_i$ multiplied by $b_j$). It's eas... |
Solve the programming task below in a Python markdown code block.
Santa Claus has received letters from $n$ different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the $i$-th kid asked Santa to give them one of $k_i$ different items as a present. Some items could ... |
Solve the programming task below in a Python markdown code block.
You have a given integer $n$. Find the number of ways to fill all $3 \times n$ tiles with the shape described in the picture below. Upon filling, no empty spaces are allowed. Shapes cannot overlap. $\square$ This picture describes when $n = 4$. The left... |
Solve the programming task below in a Python markdown code block.
Young boy Artem tries to paint a picture, and he asks his mother Medina to help him. Medina is very busy, that's why she asked for your help.
Artem wants to paint an $n \times m$ board. Each cell of the board should be colored in white or black.
Lets... |
Solve the programming task below in a Python markdown code block.
In 2020, AtCoder Inc. with an annual sales of more than one billion yen (the currency of Japan) has started a business in programming education.
One day, there was an exam where a one-year-old child must write a program that prints Hello World, and a t... |
Solve the programming task below in a Python markdown code block.
Recently Irina arrived to one of the most famous cities of Berland — the Berlatov city. There are n showplaces in the city, numbered from 1 to n, and some of them are connected by one-directional roads. The roads in Berlatov are designed in a way such t... |
Solve the programming task below in a Python markdown code block.
You are given a positive integer $D$. Let's build the following graph from it: each vertex is a divisor of $D$ (not necessarily prime, $1$ and $D$ itself are also included); two vertices $x$ and $y$ ($x > y$) have an undirected edge between them if $... |
Solve the programming task below in a Python markdown code block.
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little Elephant ought to delete exactly one any digit from number a ... |
Solve the programming task below in a Python markdown code block.
ZS the Coder and Chris the Baboon arrived at the entrance of Udayland. There is a n × n magic grid on the entrance which is filled with integers. Chris noticed that exactly one of the cells in the grid is empty, and to enter Udayland, they need to fill ... |
Solve the programming task below in a Python markdown code block.
The sum of divisors of `6` is `12` and the sum of divisors of `28` is `56`. You will notice that `12/6 = 2` and `56/28 = 2`. We shall say that `(6,28)` is a pair with a ratio of `2`. Similarly, `(30,140)` is also a pair but with a ratio of `2.4`. These... |
Solve the programming task below in a Python markdown code block.
A direced graph is strongly connected if every two nodes are reachable from each other. In a strongly connected component of a directed graph, every two nodes of the component are mutually reachable.
Constraints
* 1 ≤ |V| ≤ 10,000
* 0 ≤ |E| ≤ 30,000
*... |
Solve the programming task below in a Python markdown code block.
INTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-bit integers into a sequence of characters to print, using ... |
Solve the programming task below in a Python markdown code block.
In AtCoder, a person who has participated in a contest receives a color, which corresponds to the person's rating as follows:
- Rating 1-399 : gray
- Rating 400-799 : brown
- Rating 800-1199 : green
- Rating 1200-1599 : cyan
- Rating 1600-1999 : ... |
Solve the programming task below in a Python markdown code block.
You are given $n$ integers $w_i (i = 0, 1, ..., n-1)$ to be sorted in ascending order. You can swap two integers $w_i$ and $w_j$. Each swap operation has a cost, which is the sum of the two integers $w_i + w_j$. You can perform the operations any number... |
Solve the programming task below in a Python markdown code block.
A [Narcissistic Number](https://en.wikipedia.org/wiki/Narcissistic_number) is a positive number which is the sum of its own digits, each raised to the power of the number of digits in a given base. In this Kata, we will restrict ourselves to decimal (ba... |
Solve the programming task below in a Python markdown code block.
You are given a string $s$, consisting of brackets of two types: '(', ')', '[' and ']'.
A string is called a regular bracket sequence (RBS) if it's of one of the following types:
empty string;
'(' + RBS + ')';
'[' + RBS + ']';
RBS + RBS.
where plu... |
Solve the programming task below in a Python markdown code block.
Polycarp is preparing the first programming contest for robots. There are $n$ problems in it, and a lot of robots are going to participate in it. Each robot solving the problem $i$ gets $p_i$ points, and the score of each robot in the competition is cal... |
Solve the programming task below in a Python markdown code block.
Mobile phones are equipped with a function that displays input candidates in order to efficiently input texts such as emails. This records frequently used words and presents words that have the entered letters as initial letters as input candidates. For... |
Solve the programming task below in a Python markdown code block.
Vova's house is an array consisting of $n$ elements (yeah, this is the first problem, I think, where someone lives in the array). There are heaters in some positions of the array. The $i$-th element of the array is $1$ if there is a heater in the positi... |
Solve the programming task below in a Python markdown code block.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-th type of fish be wi, then 0 < w1 ≤ w2 ≤ ... ≤ wk holds.
P... |
Solve the programming task below in a Python markdown code block.
In this Kata, you will be given an array of unique elements, and your task is to rerrange the values so that the first max value is followed by the first minimum, followed by second max value then second min value, etc.
For example:
The first max is `... |
Solve the programming task below in a Python markdown code block.
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. ... |
Solve the programming task below in a Python markdown code block.
The football season has just ended in Berland. According to the rules of Berland football, each match is played between two teams. The result of each match is either a draw, or a victory of one of the playing teams. If a team wins the match, it gets w p... |
Solve the programming task below in a Python markdown code block.
In an infinite array with two rows, the numbers in the top row are denoted
`. . . , A[−2], A[−1], A[0], A[1], A[2], . . .`
and the numbers in the bottom row are denoted
`. . . , B[−2], B[−1], B[0], B[1], B[2], . . .`
For each integer `k`, the entry ... |
Solve the programming task below in a Python markdown code block.
Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 + 2 = 3 cubes, the third level must have 1 + 2 + 3 = 6 cubes... |
Solve the programming task below in a Python markdown code block.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total num... |
Solve the programming task below in a Python markdown code block.
Some days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it.
But I also don't want to use many numbers, so I'll choose three positive integers (they don't have to be... |
Solve the programming task below in a Python markdown code block.
Given a string, return a new string that has transformed based on the input:
* Change case of every character, ie. lower case to upper case, upper case to lower case.
* Reverse the order of words from the input.
**Note:** You will have to handle multi... |
Solve the programming task below in a Python markdown code block.
You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different.
-----Constraints-----
- 2 ≤ |S| ≤ 26, where |S| denotes the length of S.
- S consists of lowercase English letters.
-----Input... |
Solve the programming task below in a Python markdown code block.
You are given a matrix of size n × n filled with lowercase English letters. You can change no more than k letters in this matrix.
Consider all paths from the upper left corner to the lower right corner that move from a cell to its neighboring cell to t... |
Solve the programming task below in a Python markdown code block.
The function is not returning the correct values. Can you figure out why?
```python
get_planet_name(3) # should return 'Earth'
```
Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs).... |
Solve the programming task below in a Python markdown code block.
You are given an array $a$ of $n$ integers. Count the number of pairs of indices $(i, j)$ such that $i < j$ and $a_j - a_i = j - i$.
-----Input-----
The first line contains one integer $t$ ($1 \le t \le 10^4$). Then $t$ test cases follow.
The first ... |
Solve the programming task below in a Python markdown code block.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that present, so he wants to give her stones as many times as possibl... |
Solve the programming task below in a Python markdown code block.
The palindrome is a string that can be read the same way from left to right and from right to left. For example, strings "aaaaa", "1221", "bbaabb" are palindromes, however the string "chef" is not a palindrome because if we read it from right to left, w... |
Solve the programming task below in a Python markdown code block.
To help those contestants who struggle a lot in contests, the headquarters of Codeforces are planning to introduce Division 5. In this new division, the tags of all problems will be announced prior to the round to help the contestants.
The contest cons... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.