question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
Counting was a difficult task in ancient Rome. The Arabic numerals 0,1,2,3,…, 9 have not yet been disseminated. Instead, the following symbols were used:
Arabic numerals | Roman numerals | Arabic numerals | Roman numerals | Arabic numerals | Roman nume... |
Solve the programming task below in a Python markdown code block.
Oh, no!
The coronavirus has caught you, and now you're sitting in a dark cellar, with tied legs (but not hands). You have a delicious cookie, a laptop in front of you, and your ideal development environment is open. The coronavirus convinces you to sol... |
Solve the programming task below in a Python markdown code block.
Mr.X, who the handle name is T, looked at the list which written N handle names, S_1, S_2, ..., S_N.
But he couldn't see some parts of the list. Invisible part is denoted `?`.
Please calculate all possible index of the handle name of Mr.X when you sort... |
Solve the programming task below in a Python markdown code block.
Maksim has $n$ objects and $m$ boxes, each box has size exactly $k$. Objects are numbered from $1$ to $n$ in order from left to right, the size of the $i$-th object is $a_i$.
Maksim wants to pack his objects into the boxes and he will pack objects by t... |
Solve the programming task below in a Python markdown code block.
Natasha travels around Mars in the Mars rover. But suddenly it broke down, namely — the logical scheme inside it. The scheme is an undirected tree (connected acyclic graph) with a root in the vertex 1, in which every leaf (excluding root) is an input, a... |
Solve the programming task below in a Python markdown code block.
You're playing a game with a friend involving a bag of marbles. In the bag are ten marbles:
* 1 smooth red marble
* 4 bumpy red marbles
* 2 bumpy yellow marbles
* 1 smooth yellow marble
* 1 bumpy green marble
* 1 smooth green marble
You can see that t... |
Solve the programming task below in a Python markdown code block.
An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces:
* Form groups consisting of A_i children each!
Then the children who are still in the game form as ma... |
Solve the programming task below in a Python markdown code block.
Baby Badawy's first words were "AND 0 SUM BIG", so he decided to solve the following problem. Given two integers $n$ and $k$, count the number of arrays of length $n$ such that:
all its elements are integers between $0$ and $2^k-1$ (inclusive);
the bi... |
Solve the programming task below in a Python markdown code block.
You are given integer $n$. You have to arrange numbers from $1$ to $2n$, using each of them exactly once, on the circle, so that the following condition would be satisfied:
For every $n$ consecutive numbers on the circle write their sum on the blackboa... |
Solve the programming task below in a Python markdown code block.
Some time ago Mister B detected a strange signal from the space, which he started to study.
After some transformation the signal turned out to be a permutation p of length n or its cyclic shift. For the further investigation Mister B need some basis, t... |
Solve the programming task below in a Python markdown code block.
Stepan has n pens. Every day he uses them, and on the i-th day he uses the pen number i. On the (n + 1)-th day again he uses the pen number 1, on the (n + 2)-th — he uses the pen number 2 and so on.
On every working day (from Monday to Saturday, inclus... |
Solve the programming task below in a Python markdown code block.
Your task is to develop a tiny little part of spreadsheet software.
Write a program which adds up columns and rows of given table as shown in the following figure:
<image>
Input
The input consists of several datasets. Each dataset consists of:
n... |
Solve the programming task below in a Python markdown code block.
Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).
They need to arrange a plan, but there are som... |
Solve the programming task below in a Python markdown code block.
For given integers m and n, compute mn (mod 1,000,000,007). Here, A (mod M) is the remainder when A is divided by M.
Constraints
* 1 ≤ m ≤ 100
* 1 ≤ n ≤ 109
Input
m n
Two integers m and n are given in a line.
Output
Print mn (mod 1,000,000,007)... |
Solve the programming task below in a Python markdown code block.
"You must lift the dam. With a lever. I will give it to you.
You must block the canal. With a rock. I will not give the rock to you."
Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them... |
Solve the programming task below in a Python markdown code block.
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower.
He has N ... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese and Russian.
Given a string S consisting of only 1s and 0s, find the number of substrings which start and end both in 1.
In this problem, a substring is defined as a sequence of continuous characters S_{i... |
Solve the programming task below in a Python markdown code block.
$k$ people want to split $n$ candies between them. Each candy should be given to exactly one of them or be thrown away.
The people are numbered from $1$ to $k$, and Arkady is the first of them. To split the candies, Arkady will choose an integer $x$ an... |
Solve the programming task below in a Python markdown code block.
A robot cleaner is placed on the floor of a rectangle room, surrounded by walls. The floor consists of $n$ rows and $m$ columns. The rows of the floor are numbered from $1$ to $n$ from top to bottom, and columns of the floor are numbered from $1$ to $m$... |
Solve the programming task below in a Python markdown code block.
You are given $n$ points on the plane. The polygon formed from all the $n$ points is strictly convex, that is, the polygon is convex, and there are no three collinear points (i.e. lying in the same straight line). The points are numbered from $1$ to $n$... |
Solve the programming task below in a Python markdown code block.
Bob watches TV every day. He always sets the volume of his TV to $b$. However, today he is angry to find out someone has changed the volume to $a$. Of course, Bob has a remote control that can change the volume.
There are six buttons ($-5, -2, -1, +1, ... |
Solve the programming task below in a Python markdown code block.
The height of the student was measured at the medical examination. Create a program that takes height data as input, creates a frequency distribution, and outputs it. The frequency distribution is divided into 6 classes in 5 cm increments, and the numbe... |
Solve the programming task below in a Python markdown code block.
German mathematician Christian Goldbach (1690-1764) [conjectured](https://en.wikipedia.org/wiki/Goldbach%27s_conjecture) that every even number greater than 2 can be represented by the sum of two prime numbers. For example, `10` can be represented as `3... |
Solve the programming task below in a Python markdown code block.
Paprika loves permutations. She has an array $a_1, a_2, \dots, a_n$. She wants to make the array a permutation of integers $1$ to $n$.
In order to achieve this goal, she can perform operations on the array. In each operation she can choose two integers... |
Solve the programming task below in a Python markdown code block.
Let's denote as <image> the number of bits set ('1' bits) in the binary representation of the non-negative integer x.
You are given multiple queries consisting of pairs of integers l and r. For each query, find the x, such that l ≤ x ≤ r, and <image> i... |
Solve the programming task below in a Python markdown code block.
Taro is an elementary school student and has graffiti on the back of the leaflet. At one point, Taro came up with the next game.
* Write n × n grid-like squares.
* The initial state of each square is either marked or unmarked.
* Erase or write these ci... |
Solve the programming task below in a Python markdown code block.
There are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.
You can perform the following operation on this integer sequence any number of times:
Operation: Choose an integer i satisfying 1 \leq i \leq N-1. Multiply both A_i and A_{i+1} b... |
Solve the programming task below in a Python markdown code block.
Consider a linear function f(x) = Ax + B. Let's define g^{(0)}(x) = x and g^{(}n)(x) = f(g^{(}n - 1)(x)) for n > 0. For the given integer values A, B, n and x find the value of g^{(}n)(x) modulo 10^9 + 7.
-----Input-----
The only line contains four i... |
Solve the programming task below in a Python markdown code block.
C: Canisal cryptography
problem
Ebi-chan was given the string C obtained by encrypting a non-negative integer D with "canisal cipher". This cipher replaces each number in decimal notation with a fixed number (not necessarily different from the origina... |
Solve the programming task below in a Python markdown code block.
Nikolay lives in a two-storied house. There are $n$ rooms on each floor, arranged in a row and numbered from one from left to right. So each room can be represented by the number of the floor and the number of the room on this floor (room number is an i... |
Solve the programming task below in a Python markdown code block.
Origami, or the art of folding paper
Master Grus is a famous origami (paper folding) artist, who is enthusiastic about exploring the possibility of origami art. For future creation, he is now planning fundamental experiments to establish the general th... |
Solve the programming task below in a Python markdown code block.
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 ... |
Solve the programming task below in a Python markdown code block.
There are N cities on a number line. The i-th city is located at coordinate x_i.
Your objective is to visit all these cities at least once.
In order to do so, you will first set a positive integer D.
Then, you will depart from coordinate X and perform M... |
Solve the programming task below in a Python markdown code block.
There is an automatic door at the entrance of a factory. The door works in the following way: when one or several people come to the door and it is closed, the door immediately opens automatically and all people immediately come inside, when one or se... |
Solve the programming task below in a Python markdown code block.
Gerald is setting the New Year table. The table has the form of a circle; its radius equals R. Gerald invited many guests and is concerned whether the table has enough space for plates for all those guests. Consider all plates to be round and have the s... |
Solve the programming task below in a Python markdown code block.
Given an array of integers.
Return an array, where the first element is the count of positives numbers and the second element is sum of negative numbers.
If the input array is empty or null, return an empty array.
# Example
For input `[1, 2, 3, 4, 5... |
Solve the programming task below in a Python markdown code block.
William has two numbers $a$ and $b$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $k$ is picked, which is then used to perform one of the fo... |
Solve the programming task below in a Python markdown code block.
Little penguin Polo adores strings. But most of all he adores strings of length n.
One day he wanted to find a string that meets the following conditions:
1. The string consists of n lowercase English letters (that is, the string's length equals n),... |
Solve the programming task below in a Python markdown code block.
You are given a binary string $s$ (recall that a string is binary if each character is either $0$ or $1$).
Let $f(t)$ be the decimal representation of integer $t$ written in binary form (possibly with leading zeroes). For example $f(011) = 3, f(00101) ... |
Solve the programming task below in a Python markdown code block.
Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of b consecutive cells. No cell can be part of two ships, however, the ships can touch each other.
Galya doesn't know t... |
Solve the programming task below in a Python markdown code block.
Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like in chess. Almost all cells of the field are white and only ... |
Solve the programming task below in a Python markdown code block.
Little Petya was given this problem for homework:
You are given function <image> (here <image> represents the operation of taking the remainder). His task is to count the number of integers x in range [a;b] with property f(x) = x.
It is a pity that Pe... |
Solve the programming task below in a Python markdown code block.
In 2028 and after a continuous growth, AtCoder Inc. finally built an empire with six cities (City 1, 2, 3, 4, 5, 6)!
There are five means of transport in this empire:
- Train: travels from City 1 to 2 in one minute. A train can occupy at most A people.... |
Solve the programming task below in a Python markdown code block.
Story:
In the realm of numbers, the apocalypse has arrived. Hordes of zombie numbers have infiltrated and are ready to turn everything into undead. The properties of zombies are truly apocalyptic: they reproduce themselves unlimitedly and freely interac... |
Solve the programming task below in a Python markdown code block.
Given is an integer N.
Determine whether there is a pair of positive integers (A, B) such that 3^A + 5^B = N, and find one such pair if it exists.
-----Constraints-----
- 1 \leq N \leq 10^{18}
- All values in input are integers.
-----Input-----
Inpu... |
Solve the programming task below in a Python markdown code block.
Alice gave Bob two integers $a$ and $b$ ($a > 0$ and $b \ge 0$). Being a curious boy, Bob wrote down an array of non-negative integers with $\operatorname{MEX}$ value of all elements equal to $a$ and $\operatorname{XOR}$ value of all elements equal to $... |
Solve the programming task below in a Python markdown code block.
Having learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together.
Given an integer N, determine whether N can be represented as the product of two integers between 1 and 9. If it can, print Yes; if it can... |
Solve the programming task below in a Python markdown code block.
Takahashi has an N \times N grid. The square at the i-th row and the j-th column of the grid is denoted by (i,j). Particularly, the top-left square of the grid is (1,1), and the bottom-right square is (N,N).
An integer, 0 or 1, is written on M of the s... |
Solve the programming task below in a Python markdown code block.
Example
Input
2 3 1 3 1 0
Output
2
Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters. |
Solve the programming task below in a Python markdown code block.
Polycarp doesn't like integers that are divisible by $3$ or end with the digit $3$ in their decimal representation. Integers that meet both conditions are disliked by Polycarp, too.
Polycarp starts to write out the positive (greater than $0$) integers ... |
Solve the programming task below in a Python markdown code block.
A: Flick input
A college student who loves 2D, commonly known as 2D, replaced his long-used Galapagos mobile phone with a smartphone. 2D, who operated the smartphone for the first time, noticed that the character input method was a little different fro... |
Solve the programming task below in a Python markdown code block.
You came to a local shop and want to buy some chocolate bars. There are $n$ bars in the shop, $i$-th of them costs $a_i$ coins (and you want to buy all of them).
You have $m$ different coupons that allow you to buy chocolate bars. $i$-th coupon allows ... |
Solve the programming task below in a Python markdown code block.
Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s.
String p is called a substring of string s if you can read it starting from some position in the string s. For example, string "aba" has six substrings: "a", "b", "a", "ab"... |
Solve the programming task below in a Python markdown code block.
During the "Russian Code Cup" programming competition, the testing system stores all sent solutions for each participant. We know that many participants use random numbers in their programs and are often sent several solutions with the same source code ... |
Solve the programming task below in a Python markdown code block.
Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise.
You are given geometric progression b defined by two integers b_1 and q. Remind that a geometric progression is a sequence of integers b_1, b_2, b_3, ...,... |
Solve the programming task below in a Python markdown code block.
Tanya is learning how to add numbers, but so far she is not doing it correctly. She is adding two numbers $a$ and $b$ using the following algorithm:
If one of the numbers is shorter than the other, Tanya adds leading zeros so that the numbers are the s... |
Solve the programming task below in a Python markdown code block.
I've got a crazy mental illness.
I dislike numbers a lot. But it's a little complicated:
The number I'm afraid of depends on which day of the week it is...
This is a concrete description of my mental illness:
Monday --> 12
Tuesday --> numbers g... |
Solve the programming task below in a Python markdown code block.
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?
Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of th... |
Solve the programming task below in a Python markdown code block.
B-Mansion and courier
Problem Statement
Taro lives alone in a mansion. Taro, who loves studying, intends to study in his study in the house today. Taro can't concentrate outside the study, so he always studies in the study.
However, on this day, $ N ... |
Solve the programming task below in a Python markdown code block.
Given is an integer N. Find the number of digits that N has in base K.
-----Notes-----
For information on base-K representation, see Positional notation - Wikipedia.
-----Constraints-----
- All values in input are integers.
- 1 \leq N \leq 10^9
- 2... |
Solve the programming task below in a Python markdown code block.
Alice likes word "nineteen" very much. She has a string s and wants the string to contain as many such words as possible. For that reason she can rearrange the letters of the string.
For example, if she has string "xiineteenppnnnewtnee", she can get st... |
Solve the programming task below in a Python markdown code block.
There is a tree with N vertices, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N - 1), the i-th edge connects Vertex x_i and y_i.
Taro has decided to paint each vertex in white or black. Here, it is not allowed to paint two adjacent vertices both... |
Solve the programming task below in a Python markdown code block.
You have to create a function,named `insertMissingLetters`, that takes in a `string` and outputs the same string processed in a particular way.
The function should insert **only after the first occurrence** of each character of the input string, all th... |
Solve the programming task below in a Python markdown code block.
In elementary arithmetic a "carry" is a digit that is transferred from one column of digits to another column of more significant digits during a calculation algorithm.
This Kata is about determining the number of carries performed during the addition ... |
Solve the programming task below in a Python markdown code block.
Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the very top of the page. The relative order of the other chats... |
Solve the programming task below in a Python markdown code block.
Take a sentence (string) and reverse each word in the sentence. Do not reverse the order of the words, just the letters in each word.
If there is punctuation, it should be interpreted as a regular character; no special rules.
If there is spacing befor... |
Solve the programming task below in a Python markdown code block.
A tennis tournament with n participants is running. The participants are playing by an olympic system, so the winners move on and the losers drop out.
The tournament takes place in the following way (below, m is the number of the participants of the cu... |
Solve the programming task below in a Python markdown code block.
Berland Music is a music streaming service built specifically to support Berland local artist. Its developers are currently working on a song recommendation module.
So imagine Monocarp got recommended $n$ songs, numbered from $1$ to $n$. The $i$-th son... |
Solve the programming task below in a Python markdown code block.
Given an array $a$ of length $n$, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.
A sequence $b$ is a subsequence of an array $a$ if $b$ can be obtained from $a$ by deleting some (possibly z... |
Solve the programming task below in a Python markdown code block.
You have a large electronic screen which can display up to $998244353$ decimal digits. The digits are displayed in the same way as on different electronic alarm clocks: each place for a digit consists of $7$ segments which can be turned on and off to co... |
Solve the programming task below in a Python markdown code block.
Chef loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Let F_{d}(x) equals to the number ... |
Solve the programming task below in a Python markdown code block.
There are four towns, numbered 1,2,3 and 4. Also, there are three roads. The i-th road connects different towns a_i and b_i bidirectionally. No two roads connect the same pair of towns. Other than these roads, there is no way to travel between these tow... |
Solve the programming task below in a Python markdown code block.
Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A.
The problem has N test cases, all of which must be passed to get an AC verdict.
Takahashi's submission has passed M cases out of the N test cases... |
Solve the programming task below in a Python markdown code block.
There are $n$ segments on a $Ox$ axis $[l_1, r_1]$, $[l_2, r_2]$, ..., $[l_n, r_n]$. Segment $[l, r]$ covers all points from $l$ to $r$ inclusive, so all $x$ such that $l \le x \le r$.
Segments can be placed arbitrarily — be inside each other, coincid... |
Solve the programming task below in a Python markdown code block.
Your task is to determine how many files of the copy queue you will be able to save into your Hard Disk Drive. The files must be saved in the order they appear in the queue.
### Input:
* Array of file sizes `(0 <= s <= 100)`
* Capacity of the HD `(0 ... |
Solve the programming task below in a Python markdown code block.
Takahashi has received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph are represented by (u_i, v_i). There are no self-loops and multiple edges in this graph.
Based on this graph, Takahashi is now constructing a new... |
Solve the programming task below in a Python markdown code block.
Given is an integer sequence of length N+1: A_0, A_1, A_2, \ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of verti... |
Solve the programming task below in a Python markdown code block.
You are given a string s of length n.
Does a tree with n vertices that satisfies the following conditions exist?
- The vertices are numbered 1,2,..., n.
- The edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.
- If the i-th char... |
Solve the programming task below in a Python markdown code block.
A sum of p rubles is charged from Arkady's mobile phone account every day in the morning. Among the following m days, there are n days when Arkady will top up the account: in the day d_{i} he will deposit t_{i} rubles on his mobile phone account. Arkady... |
Solve the programming task below in a Python markdown code block.
Special Agent Smart Beaver works in a secret research department of ABBYY. He's been working there for a long time and is satisfied with his job, as it allows him to eat out in the best restaurants and order the most expensive and exotic wood types ther... |
Solve the programming task below in a Python markdown code block.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the elephant can move 1, 2, 3, 4 or 5 positions forward. Deter... |
Solve the programming task below in a Python markdown code block.
Vasya and Petya take part in a Codeforces round. The round lasts for two hours and contains five problems.
For this round the dynamic problem scoring is used. If you were lucky not to participate in any Codeforces round with dynamic problem scoring, he... |
Solve the programming task below in a Python markdown code block.
You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal to x / y.
Your favorite rationa... |
Solve the programming task below in a Python markdown code block.
You might know some pretty large perfect squares. But what about the NEXT one?
Complete the `findNextSquare` method that finds the next integral perfect square after the one passed as a parameter. Recall that an integral perfect square is an integer ... |
Solve the programming task below in a Python markdown code block.
Tsuruga Castle, a symbol of Aizuwakamatsu City, was named "Tsuruga Castle" after Gamo Ujisato built a full-scale castle tower. You can overlook the Aizu basin from the castle tower. On a clear day, you can see Tsuruga Castle from the summit of Mt. Iimor... |
Solve the programming task below in a Python markdown code block.
Recently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. However, she thought there were too many items, so now she wants to discard m (1 ≤ m ≤ n) special items of them.
These n items are marked with indic... |
Solve the programming task below in a Python markdown code block.
Omkar's most recent follower, Ajit, has entered the Holy Forest. Ajit realizes that Omkar's forest is an n by m grid (1 ≤ n, m ≤ 2000) of some non-negative integers. Since the forest is blessed by Omkar, it satisfies some special conditions:
1. For a... |
Solve the programming task below in a Python markdown code block.
A boy named Vasya wants to play an old Russian solitaire called "Accordion". In this solitaire, the player must observe the following rules:
* A deck of n cards is carefully shuffled, then all n cards are put on the table in a line from left to right... |
Solve the programming task below in a Python markdown code block.
The only difference between this problem and D2 is that you don't have to provide the way to construct the answer in this problem, but you have to do it in D2.
There's a table of $n \times m$ cells ($n$ rows and $m$ columns). The value of $n \cdot m$ i... |
Solve the programming task below in a Python markdown code block.
Sample testcase 3 has a mistake, so we erased this case and rejudged all solutions of this problem. (21:01)
Snuke got a sequence $a$ of length $n$ from AtCoder company. All elements in $a$ are distinct.
He made a sequence $b$, but actually, he is not r... |
Solve the programming task below in a Python markdown code block.
Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.
The wall c... |
Solve the programming task below in a Python markdown code block.
Polycarp found on the street an array $a$ of $n$ elements.
Polycarp invented his criterion for the beauty of an array. He calls an array $a$ beautiful if at least one of the following conditions must be met for each different pair of indices $i \ne j$:... |
Solve the programming task below in a Python markdown code block.
Petya loves football very much. One day, as he was watching a football match, he was writing the players' current positions on a piece of paper. To simplify the situation he depicted it as a string consisting of zeroes and ones. A zero corresponds to pl... |
Solve the programming task below in a Python markdown code block.
The main characters have been omitted to be short.
You are given a directed unweighted graph without loops with $n$ vertexes and a path in it (that path is not necessary simple) given by a sequence $p_1, p_2, \ldots, p_m$ of $m$ vertexes; for each $1 \... |
Solve the programming task below in a Python markdown code block.
Congratulations! That Special Someone has given you their phone number.
But WAIT, is it a valid number?
Your task is to write a function that verifies whether a given string contains a valid British mobile (cell) phone number or not.
If valid, retu... |
Solve the programming task below in a Python markdown code block.
Create a program that takes two dates as input and outputs the number of days between the two dates.
Date 1 (y1, m1, d1) is the same as or earlier than date 2 (y2, m2, d2). Date 1 is included in the number of days, not date 2. Also, take the leap year ... |
Solve the programming task below in a Python markdown code block.
Given the number n, find the smallest positive integer which has exactly n divisors. It is guaranteed that for the given n the answer will not exceed 1018.
Input
The first line of the input contains integer n (1 ≤ n ≤ 1000).
Output
Output the smalle... |
Solve the programming task below in a Python markdown code block.
In this Kata you are a builder and you are assigned a job of building a wall with a specific size (God knows why...).
Create a function called `build_a_wall` (or `buildAWall` in JavaScript) that takes `x` and `y` as integer arguments (which represent t... |
Solve the programming task below in a Python markdown code block.
Athenaeus has just finished creating his latest musical composition and will present it tomorrow to the people of Athens. Unfortunately, the melody is rather dull and highly likely won't be met with a warm reception.
His song consists of $n$ notes, whi... |
Solve the programming task below in a Python markdown code block.
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.