question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
Given a string of characters, I want the function `findMiddle()`/`find_middle()` to return the middle number in the product of each digit in the string.
Example: 's7d8jd9' -> 7, 8, 9 -> 7\*8\*9=504, thus 0 should be returned as an integer.
Not all str... |
Solve the programming task below in a Python markdown code block.
Consider a football tournament where n teams participate. Each team has two football kits: for home games, and for away games. The kit for home games of the i-th team has color xi and the kit for away games of this team has color yi (xi ≠ yi).
In the t... |
Solve the programming task below in a Python markdown code block.
You are the head of a large enterprise. $n$ people work at you, and $n$ is odd (i. e. $n$ is not divisible by $2$).
You have to distribute salaries to your employees. Initially, you have $s$ dollars for it, and the $i$-th employee should get a salary f... |
Solve the programming task below in a Python markdown code block.
Valery is very interested in magic. Magic attracts him so much that he sees it everywhere. He explains any strange and weird phenomenon through intervention of supernatural forces. But who would have thought that even in a regular array of numbers Valer... |
Solve the programming task below in a Python markdown code block.
One day Anna got the following task at school: to arrange several numbers in a circle so that any two neighboring numbers differs exactly by 1. Anna was given several numbers and arranged them in a circle to fulfill the task. Then she wanted to check if... |
Solve the programming task below in a Python markdown code block.
Today, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.
As the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that c... |
Solve the programming task below in a Python markdown code block.
## Task
An `ATM` ran out of 10 dollar bills and only has `100, 50 and 20` dollar bills.
Given an amount between `40 and 10000 dollars (inclusive)` and assuming that the ATM wants to use as few bills as possible, determinate the minimal number of 100... |
Solve the programming task below in a Python markdown code block.
Wilbur is playing with a set of n points on the coordinate plane. All points have non-negative integer coordinates. Moreover, if some point (x, y) belongs to the set, then all points (x', y'), such that 0 ≤ x' ≤ x and 0 ≤ y' ≤ y also belong to this set.... |
Solve the programming task below in a Python markdown code block.
One day Vasya was sitting on a not so interesting Maths lesson and making an origami from a rectangular a mm × b mm sheet of paper (a > b). Usually the first step in making an origami is making a square piece of paper from the rectangular sheet by fol... |
Solve the programming task below in a Python markdown code block.
Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all number... |
Solve the programming task below in a Python markdown code block.
There is a bus stop near the university. The lessons are over, and n students come to the stop. The i-th student will appear at the bus stop at time ti (all ti's are distinct).
We shall assume that the stop is located on the coordinate axis Ox, at poin... |
Solve the programming task below in a Python markdown code block.
A wise man told Kerem "Different is good" once, so Kerem wants all things in his life to be different.
Kerem recently got a string s consisting of lowercase English letters. Since Kerem likes it when things are different, he wants all substrings of hi... |
Solve the programming task below in a Python markdown code block.
Alice is the leader of the State Refactoring Party, and she is about to become the prime minister.
The elections have just taken place. There are $n$ parties, numbered from $1$ to $n$. The $i$-th party has received $a_i$ seats in the parliament.
Alic... |
Solve the programming task below in a Python markdown code block.
**Introduction**
Little Petya very much likes sequences. However, recently he received a sequence as a gift from his mother.
Petya didn't like it at all! He decided to make a single replacement. After this replacement, Petya would like to the sequence... |
Solve the programming task below in a Python markdown code block.
Playing with Stones
Koshiro and Ukiko are playing a game with black and white stones. The rules of the game are as follows:
1. Before starting the game, they define some small areas and place "one or more black stones and one or more white stones" in ... |
Solve the programming task below in a Python markdown code block.
**This Kata is intended as a small challenge for my students**
All Star Code Challenge #18
Create a function called that accepts 2 string arguments and returns an integer of the count of occurrences the 2nd argument is found in the first one.
If no o... |
Solve the programming task below in a Python markdown code block.
You are given an array $a$ of $n$ non-negative integers. In one operation you can change any number in the array to any other non-negative integer.
Let's define the cost of the array as $\operatorname{DIFF}(a) - \operatorname{MEX}(a)$, where $\operator... |
Solve the programming task below in a Python markdown code block.
A text editor is a useful software tool that can help people in various situations including writing and programming. Your job in this problem is to construct an offline text editor, i.e., to write a program that first reads a given text and a sequence ... |
Solve the programming task below in a Python markdown code block.
Polycarp likes squares and cubes of positive integers. Here is the beginning of the sequence of numbers he likes: $1$, $4$, $8$, $9$, ....
For a given number $n$, count the number of integers from $1$ to $n$ that Polycarp likes. In other words, find th... |
Solve the programming task below in a Python markdown code block.
Not so long ago, Vlad came up with an interesting function:
$f_a(x)=\left\lfloor\frac{x}{a}\right\rfloor + x mod a$, where $\left\lfloor\frac{x}{a}\right\rfloor$ is $\frac{x}{a}$, rounded down, $x mod a$ — the remainder of the integer division of $x$ b... |
Solve the programming task below in a Python markdown code block.
Mr. Chanek has an integer represented by a string $s$. Zero or more digits have been erased and are denoted by the character _. There are also zero or more digits marked by the character X, meaning they're the same digit.
Mr. Chanek wants to count the ... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
Princess Rupsa saw one of her friends playing a special game. The game goes as follows:
N+1 numbers occur sequentially (one at a time) from A_{0} to A_{N}.
You must write t... |
Solve the programming task below in a Python markdown code block.
Aizu Gakuen High School holds a school festival every year. The most popular of these is the haunted house. The most popular reason is that 9 classes do haunted houses instead of 1 or 2 classes. Each one has its own unique haunted house. Therefore, many... |
Solve the programming task below in a Python markdown code block.
Petya is preparing for his birthday. He decided that there would be $n$ different dishes on the dinner table, numbered from $1$ to $n$. Since Petya doesn't like to cook, he wants to order these dishes in restaurants.
Unfortunately, all dishes are prepa... |
Solve the programming task below in a Python markdown code block.
There are some stones on Bob's table in a row, and each of them can be red, green or blue, indicated by the characters `R`, `G`, and `B`.
Help Bob find the minimum number of stones he needs to remove from the table so that the stones in each pair of ad... |
Solve the programming task below in a Python markdown code block.
For years, the Day of city N was held in the most rainy day of summer. New mayor decided to break this tradition and select a not-so-rainy day for the celebration. The mayor knows the weather forecast for the $n$ days of summer. On the $i$-th day, $a_i$... |
Solve the programming task below in a Python markdown code block.
You are given n points on a plane. All the points are distinct and no three of them lie on the same line. Find the number of parallelograms with the vertices at the given points.
-----Input-----
The first line of the input contains integer n (1 ≤ n ≤... |
Solve the programming task below in a Python markdown code block.
A well-known art union called "Kalevich is Alive!" manufactures objects d'art (pictures). The union consists of n painters who decided to organize their work as follows.
Each painter uses only the color that was assigned to him. The colors are distinct... |
Solve the programming task below in a Python markdown code block.
For some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all.
Anvils come in different sizes and shapes. Quite often they ge... |
Solve the programming task below in a Python markdown code block.
You are given a simple weighted connected undirected graph, consisting of $n$ vertices and $m$ edges.
A path in the graph of length $k$ is a sequence of $k+1$ vertices $v_1, v_2, \dots, v_{k+1}$ such that for each $i$ $(1 \le i \le k)$ the edge $(v_i, ... |
Solve the programming task below in a Python markdown code block.
The following problem is well-known: given integers n and m, calculate $2^{n} \operatorname{mod} m$,
where 2^{n} = 2·2·...·2 (n factors), and $x \operatorname{mod} y$ denotes the remainder of division of x by y.
You are asked to solve the "reverse" p... |
Solve the programming task below in a Python markdown code block.
The R2 company has n employees working for it. The work involves constant exchange of ideas, sharing the stories of success and upcoming challenging. For that, R2 uses a famous instant messaging program Spyke.
R2 has m Spyke chats just to discuss all s... |
Solve the programming task below in a Python markdown code block.
A classroom in a school has six rows with 3 desks in each row. Two people can use the same desk: one sitting on the left and one sitting on the right.
Some places are already occupied, and some places are vacant. Petya has just entered the class and w... |
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.
There is a vampire family of N members. Vampires are also known as extreme gourmets. Of course vampires' foods are human blood. However, not all kinds of blood is acceptable for them. Vampires drink blood that K blood types of ones are mixed, and each v... |
Solve the programming task below in a Python markdown code block.
Long time ago there was a symmetric array $a_1,a_2,\ldots,a_{2n}$ consisting of $2n$ distinct integers. Array $a_1,a_2,\ldots,a_{2n}$ is called symmetric if for each integer $1 \le i \le 2n$, there exists an integer $1 \le j \le 2n$ such that $a_i = -a_... |
Solve the programming task below in a Python markdown code block.
You are given an array consisting of $n$ integers $a_1, a_2, \dots , a_n$ and an integer $x$. It is guaranteed that for every $i$, $1 \le a_i \le x$.
Let's denote a function $f(l, r)$ which erases all values such that $l \le a_i \le r$ from the array $... |
Solve the programming task below in a Python markdown code block.
The princess is going to escape the dragon's cave, and she needs to plan it carefully.
The princess runs at vp miles per hour, and the dragon flies at vd miles per hour. The dragon will discover the escape after t hours and will chase the princess imme... |
Solve the programming task below in a Python markdown code block.
Write a function that takes one or more arrays and returns a new array of unique values in the order of the original provided arrays.
In other words, all values present from all arrays should be included in their original order, but with no duplicates ... |
Solve the programming task below in a Python markdown code block.
Kana was just an ordinary high school girl before a talent scout discovered her. Then, she became an idol. But different from the stereotype, she is also a gameholic.
One day Kana gets interested in a new adventure game called Dragon Quest. In this ga... |
Solve the programming task below in a Python markdown code block.
Quite recently a creative student Lesha had a lecture on trees. After the lecture Lesha was inspired and came up with the tree of his own which he called a k-tree.
A k-tree is an infinite rooted tree where:
each vertex has exactly k children; each ... |
Solve the programming task below in a Python markdown code block.
[Image]
As some of you know, cubism is a trend in art, where the problem of constructing volumetrical shape on a plane with a combination of three-dimensional geometric shapes comes to the fore.
A famous sculptor Cicasso, whose self-portrait you can... |
Solve the programming task below in a Python markdown code block.
Create a program that reads poker hand data and outputs the role for each. However, this issue follows the rules below.
* Poker is a competition with 5 playing cards.
* No more than 5 cards with the same number.
* There is no joker.
* Suppose you only ... |
Solve the programming task below in a Python markdown code block.
Description
THE BY DOLM @ STER is a training simulation game scheduled to be released on EXIDNA by 1rem on April 1, 2010. For the time being, it probably has nothing to do with an arcade game where the network connection service stopped earlier this mo... |
Solve the programming task below in a Python markdown code block.
Tokitsukaze and CSL are playing a little game of stones.
In the beginning, there are $n$ piles of stones, the $i$-th pile of which has $a_i$ stones. The two players take turns making moves. Tokitsukaze moves first. On each turn the player chooses a non... |
Solve the programming task below in a Python markdown code block.
In this kata you need to create a function that takes a 2D array/list of non-negative integer pairs and returns the sum of all the "saving" that you can have getting the [LCM](https://en.wikipedia.org/wiki/Least_common_multiple) of each couple of number... |
Solve the programming task below in a Python markdown code block.
This is yet another problem on regular bracket sequences.
A bracket sequence is called regular, if by inserting "+" and "1" into it we get a correct mathematical expression. For example, sequences "(())()", "()" and "(()(()))" are regular, while ")(", ... |
Solve the programming task below in a Python markdown code block.
The clique problem is one of the most well-known NP-complete problems. Under some simplification it can be formulated as follows. Consider an undirected graph G. It is required to find a subset of vertices C of the maximum size such that any two of them... |
Solve the programming task below in a Python markdown code block.
Not to be confused with chessboard.
[Image]
-----Input-----
The first line of input contains a single integer N (1 ≤ N ≤ 100) — the number of cheeses you have.
The next N lines describe the cheeses you have. Each line contains two space-separated... |
Solve the programming task below in a Python markdown code block.
If we multiply the integer `717 (n)` by `7 (k)`, the result will be equal to `5019`.
Consider all the possible ways that this last number may be split as a string and calculate their corresponding sum obtained by adding the substrings as integers.... |
Solve the programming task below in a Python markdown code block.
Warawreh created a great company called Nanosoft. The only thing that Warawreh still has to do is to place a large picture containing its logo on top of the company's building.
The logo of Nanosoft can be described as four squares of the same size merg... |
Solve the programming task below in a Python markdown code block.
Let us call two integers $x$ and $y$ adjacent if $\frac{lcm(x, y)}{gcd(x, y)}$ is a perfect square. For example, $3$ and $12$ are adjacent, but $6$ and $9$ are not.
Here $gcd(x, y)$ denotes the greatest common divisor (GCD) of integers $x$ and $y$, and... |
Solve the programming task below in a Python markdown code block.
Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is a_{i}, and after a week of discounts its price will be b_{i}.
Not all of sellers are honest,... |
Solve the programming task below in a Python markdown code block.
You are given two arrays of length $n$: $a_1, a_2, \dots, a_n$ and $b_1, b_2, \dots, b_n$.
You can perform the following operation any number of times:
Choose integer index $i$ ($1 \le i \le n$);
Swap $a_i$ and $b_i$.
What is the minimum possible su... |
Solve the programming task below in a Python markdown code block.
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.
We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
-----Constrai... |
Solve the programming task below in a Python markdown code block.
There are $n$ seats in the train's car and there is exactly one passenger occupying every seat. The seats are numbered from $1$ to $n$ from left to right. The trip is long, so each passenger will become hungry at some moment of time and will go to take ... |
Solve the programming task below in a Python markdown code block.
Alice got many presents these days. So she decided to pack them into boxes and send them to her friends.
There are $n$ kinds of presents. Presents of one kind are identical (i.e. there is no way to distinguish two gifts of the same kind). Presents of d... |
Solve the programming task below in a Python markdown code block.
You are given several queries. Each query consists of three integers $p$, $q$ and $b$. You need to answer whether the result of $p/q$ in notation with base $b$ is a finite fraction.
A fraction in notation with base $b$ is finite if it contains finite n... |
Solve the programming task below in a Python markdown code block.
You know that the Martians use a number system with base k. Digit b (0 ≤ b < k) is considered lucky, as the first contact between the Martians and the Earthlings occurred in year b (by Martian chronology).
A digital root d(x) of number x is a number th... |
Solve the programming task below in a Python markdown code block.
Goa'uld Apophis captured Jack O'Neill's team again! Jack himself was able to escape, but by that time Apophis's ship had already jumped to hyperspace. But Jack knows on what planet will Apophis land. In order to save his friends, Jack must repeatedly go... |
Solve the programming task below in a Python markdown code block.
You are given integers N and M.
Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.
-----Constraints-----
- All va... |
Solve the programming task below in a Python markdown code block.
Let's define $S(x)$ to be the sum of digits of number $x$ written in decimal system. For example, $S(5) = 5$, $S(10) = 1$, $S(322) = 7$.
We will call an integer $x$ interesting if $S(x + 1) < S(x)$. In each test you will be given one integer $n$. Your ... |
Solve the programming task below in a Python markdown code block.
Given an array of numbers, return the difference between the largest and smallest values.
For example:
`[23, 3, 19, 21, 16]` should return `20` (i.e., `23 - 3`).
`[1, 434, 555, 34, 112]` should return `554` (i.e., `555 - 1`).
The array will contain... |
Solve the programming task below in a Python markdown code block.
The alphabetized kata
---------------------
Re-order the characters of a string, so that they are concatenated into a new string in "case-insensitively-alphabetical-order-of-appearance" order. Whitespace and punctuation shall simply be removed!
The in... |
Solve the programming task below in a Python markdown code block.
Someone give a strange birthday present to Ivan. It is hedgehog — connected undirected graph in which one vertex has degree at least $3$ (we will call it center) and all other vertices has degree 1. Ivan thought that hedgehog is too boring and decided t... |
Solve the programming task below in a Python markdown code block.
ButCoder Inc. runs a programming competition site called ButCoder. In this site, a user is given an integer value called rating that represents his/her skill, which changes each time he/she participates in a contest. The initial value of a new user's ra... |
Solve the programming task below in a Python markdown code block.
A tree is a connected graph without cycles. A rooted tree has a special vertex called the root. The parent of a vertex $v$ (different from root) is the previous to $v$ vertex on the shortest path from the root to the vertex $v$. Children of the vertex $... |
Solve the programming task below in a Python markdown code block.
You have been assigned to develop a filter for bad messages in the in-game chat. A message is a string $S$ of length $n$, consisting of lowercase English letters and characters ')'. The message is bad if the number of characters ')' at the end of the st... |
Solve the programming task below in a Python markdown code block.
Implement a function, so it will produce a sentence out of the given parts.
Array of parts could contain:
- words;
- commas in the middle;
- multiple periods at the end.
Sentence making rules:
- there must always be a space between words;
- there must... |
Solve the programming task below in a Python markdown code block.
You are given n integers a_1, a_2, ..., a_{n}. Find the number of pairs of indexes i, j (i < j) that a_{i} + a_{j} is a power of 2 (i. e. some integer x exists so that a_{i} + a_{j} = 2^{x}).
-----Input-----
The first line contains the single positiv... |
Solve the programming task below in a Python markdown code block.
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.
Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly pe... |
Solve the programming task below in a Python markdown code block.
A pair of positive integers $(a,b)$ is called special if $\lfloor \frac{a}{b} \rfloor = a mod b$. Here, $\lfloor \frac{a}{b} \rfloor$ is the result of the integer division between $a$ and $b$, while $a mod b$ is its remainder.
You are given two integer... |
Solve the programming task below in a Python markdown code block.
Heidi the Cow is aghast: cracks in the northern Wall? Zombies gathering outside, forming groups, preparing their assault? This must not happen! Quickly, she fetches her HC^2 (Handbook of Crazy Constructions) and looks for the right chapter:
How to buil... |
Solve the programming task below in a Python markdown code block.
This kata is part of the collection [Mary's Puzzle Books](https://www.codewars.com/collections/marys-puzzle-books).
# Zero Terminated Sum
Mary has another puzzle book, and it's up to you to help her out! This book is filled with zero-terminated substr... |
Solve the programming task below in a Python markdown code block.
Two players play a game. The game is played on a rectangular board with n × m squares. At the beginning of the game two different squares of the board have two chips. The first player's goal is to shift the chips to the same square. The second player ai... |
Solve the programming task below in a Python markdown code block.
Generalized leap year
Normally, whether or not the year x is a leap year is defined as follows.
1. If x is a multiple of 400, it is a leap year.
2. Otherwise, if x is a multiple of 100, it is not a leap year.
3. Otherwise, if x is a multiple of 4, it ... |
Solve the programming task below in a Python markdown code block.
A Hitachi string is a concatenation of one or more copies of the string `hi`.
For example, `hi` and `hihi` are Hitachi strings, while `ha` and `hii` are not.
Given a string S, determine whether S is a Hitachi string.
Constraints
* The length of S is... |
Solve the programming task below in a Python markdown code block.
Mister B once received a gift: it was a book about aliens, which he started read immediately. This book had c pages.
At first day Mister B read v_0 pages, but after that he started to speed up. Every day, starting from the second, he read a pages more ... |
Solve the programming task below in a Python markdown code block.
Binary with 0 and 1 is good, but binary with only 0 is even better! Originally, this is a concept designed by Chuck Norris to send so called unary messages.
Can you write a program that can send and receive this messages?
Rules
The input message cons... |
Solve the programming task below in a Python markdown code block.
There is a country with n citizens. The i-th of them initially has a_{i} money. The government strictly controls the wealth of its citizens. Whenever a citizen makes a purchase or earns some money, they must send a receipt to the social services mention... |
Solve the programming task below in a Python markdown code block.
A car moves from point A to point B at speed v meters per second. The action takes place on the X-axis. At the distance d meters from A there are traffic lights. Starting from time 0, for the first g seconds the green light is on, then for the following... |
Solve the programming task below in a Python markdown code block.
One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted by terrorists, but he rarely won... |
Solve the programming task below in a Python markdown code block.
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x < y) from the set, such that y = x·k.
You're given a set of n distinct po... |
Solve the programming task below in a Python markdown code block.
C: Namo .. Cut
problem
-Defeat the mysterious giant jellyfish, codenamed "Nari"-
"Nari" has a very strong vitality, so if you don't keep cutting quickly, it will be revived in a blink of an eye. We are making trial and error every day to find out how... |
Solve the programming task below in a Python markdown code block.
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
Read the inputs from stdin solve the problem and write the answer to stdout (do not di... |
Solve the programming task below in a Python markdown code block.
You are given an array $a$ of length $n$, and an integer $x$. You can perform the following operation as many times as you would like (possibly zero): replace two adjacent elements of the array by their sum. For example, if the initial array was $[3, 6,... |
Solve the programming task below in a Python markdown code block.
By 2312 there were n Large Hadron Colliders in the inhabited part of the universe. Each of them corresponded to a single natural number from 1 to n. However, scientists did not know what activating several colliders simultaneously could cause, so the co... |
Solve the programming task below in a Python markdown code block.
Throughout Igor K.'s life he has had many situations worthy of attention. We remember the story with the virus, the story of his mathematical career and of course, his famous programming achievements. However, one does not always adopt new hobbies, one ... |
Solve the programming task below in a Python markdown code block.
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob — to check his answers, he ... |
Solve the programming task below in a Python markdown code block.
You had $n$ positive integers $a_1, a_2, \dots, a_n$ arranged in a circle. For each pair of neighboring numbers ($a_1$ and $a_2$, $a_2$ and $a_3$, ..., $a_{n - 1}$ and $a_n$, and $a_n$ and $a_1$), you wrote down: are the numbers in the pair equal or not... |
Solve the programming task below in a Python markdown code block.
An element in an array is dominant if it is greater than all elements to its right. You will be given an array and your task will be to return a list of all dominant elements. For example:
```Haskell
solve([1,21,4,7,5]) = [21,7,5] because 21, 7 and 5 ar... |
Solve the programming task below in a Python markdown code block.
You still have partial information about the score during the historic football match. You are given a set of pairs $(a_i, b_i)$, indicating that at some point during the match the score was "$a_i$: $b_i$". It is known that if the current score is «$x$:... |
Solve the programming task below in a Python markdown code block.
As a part of this Kata, you need to create a function that when provided with a triplet, returns the index of the numerical element that lies between the other two elements.
The input to the function will be an array of three distinct numbers (Haskell:... |
Solve the programming task below in a Python markdown code block.
How many multiples of d are there among the integers between L and R (inclusive)?
Constraints
* All values in input are integers.
* 1 \leq L \leq R \leq 100
* 1 \leq d \leq 100
Input
Input is given from Standard Input in the following format:
L R ... |
Solve the programming task below in a Python markdown code block.
You are given an array $a$, consisting of $n$ positive integers.
Let's call a concatenation of numbers $x$ and $y$ the number that is obtained by writing down numbers $x$ and $y$ one right after another without changing the order. For example, a concat... |
Solve the programming task below in a Python markdown code block.
Andrii is good in Math, but not in Programming. He is asking you to solve following problem: Given an integer number N and two sets of integer A and B. Let set A contain all numbers from 1 to N and set B contain all numbers from N + 1 to 2N. Multiset C ... |
Solve the programming task below in a Python markdown code block.
### Count the number of Duplicates
Write a function that will return the count of **distinct case-insensitive** alphabetic characters and numeric digits that occur more than
once in the input string.
The input string can be assumed to contain only al... |
Solve the programming task below in a Python markdown code block.
A bracket sequence is a string that is one of the following:
- An empty string;
- The concatenation of (, A, and ) in this order, for some bracket sequence A ;
- The concatenation of A and B in this order, for some non-empty bracket sequences A and B... |
Solve the programming task below in a Python markdown code block.
D: Sontaku (Surmise)
Some twins like even numbers.
Count how many even numbers are in $ N $ integers $ A_1, A_2, A_3, \ dots, A_N $.
input
The integer $ N $ is given on the first line.
On the second line, $ N $ integers $ A_1, A_2, A_3, \ dots, A_N... |
Solve the programming task below in a Python markdown code block.
You will get an array of numbers.
Every preceding number is smaller than the one following it.
Some numbers will be missing, for instance:
```
[-3,-2,1,5] //missing numbers are: -1,0,2,3,4
```
Your task is to return an array of those missing numbers:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.