question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
A message from humans to extraterrestrial intelligence was sent through the Arecibo radio telescope in Puerto Rico on the afternoon of Saturday November l6, l974. The message consisted of l679 bits and was meant to be translated to a rectangular picture... |
Solve the programming task below in a Python markdown code block.
Write a function that takes an arbitrary number of strings and interlaces them (combines them by alternating characters from each string).
For example `combineStrings('abc', '123')` should return `'a1b2c3'`.
If the strings are different lengths the fu... |
Solve the programming task below in a Python markdown code block.
Gaurang has grown up in a mystical universe. He is faced by $n$ consecutive 2D planes. He shoots a particle of decay age $k$ at the planes.
A particle can pass through a plane directly, however, every plane produces an identical copy of the particle go... |
Solve the programming task below in a Python markdown code block.
A group of people played a game. All players had distinct scores, which are positive integers.
Takahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i.
Find the maximum possible nu... |
Solve the programming task below in a Python markdown code block.
There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.
Extend t... |
Solve the programming task below in a Python markdown code block.
Witua is a little student from the University of Lviv. He enjoys studying math. Witua knows a lot of famous mathematicians like Eratosthenes, Pythagoras, Fermat, Diophantus, Furko, Gauss and so on. However, his favorite one is Euler. The only thing Witu... |
Solve the programming task below in a Python markdown code block.
There is a double-track line (up and down are separate lines and pass each other everywhere). There are 11 stations on this line, including the terminal station, and each station is called by the section number shown in the figure.
<image>
Trains dep... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese and Russian.
You are given a multiset of N integers. Please find such a nonempty subset of it that the sum of the subset's elements is divisible by N. Otherwise, state that this subset doesn't exist.
----... |
Solve the programming task below in a Python markdown code block.
A coordinate line has n segments, the i-th segment starts at the position l_{i} and ends at the position r_{i}. We will denote such a segment as [l_{i}, r_{i}].
You have suggested that one of the defined segments covers all others. In other words, ther... |
Solve the programming task below in a Python markdown code block.
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.
Two antennas can communicate directly if the distance between th... |
Solve the programming task below in a Python markdown code block.
Complete the method so that it formats the words into a single comma separated value. The last word should be separated by the word 'and' instead of a comma. The method takes in an array of strings and returns a single formatted string. Empty string val... |
Solve the programming task below in a Python markdown code block.
Today at the lesson Vitya learned a very interesting function — mex. Mex of a sequence of numbers is the minimum non-negative number that is not present in the sequence as element. For example, mex([4, 33, 0, 1, 1, 5]) = 2 and mex([1, 2, 3]) = 0.
Vitya... |
Solve the programming task below in a Python markdown code block.
As Gerald sets the table, Alexander sends the greeting cards, and Sergey and his twins create an army of clone snowmen, Gennady writes a New Year contest.
The New Year contest begins at 18:00 (6.00 P.M.) on December 31 and ends at 6:00 (6.00 A.M.) on J... |
Solve the programming task below in a Python markdown code block.
You have unlimited number of coins with values $1, 2, \ldots, n$. You want to select some set of coins having the total value of $S$.
It is allowed to have multiple coins with the same value in the set. What is the minimum number of coins required to ... |
Solve the programming task below in a Python markdown code block.
Ivan has n different boxes. The first of them contains some balls of n different colors.
Ivan wants to play a strange game. He wants to distribute the balls into boxes in such a way that for every i (1 ≤ i ≤ n) i-th box will contain all balls with colo... |
Solve the programming task below in a Python markdown code block.
How many strings can be obtained by applying the following operation on a string S exactly K times: "choose one lowercase English letter and insert it somewhere"?
The answer can be enormous, so print it modulo (10^9+7).
-----Constraints-----
- K is an... |
Solve the programming task below in a Python markdown code block.
Your boss decided to save money by purchasing some cut-rate optical character recognition software for scanning in the text of old novels to your database. At first it seems to capture words okay, but you quickly notice that it throws in a lot of number... |
Solve the programming task below in a Python markdown code block.
After returned from forest, Alyona started reading a book. She noticed strings s and t, lengths of which are n and m respectively. As usual, reading bored Alyona and she decided to pay her attention to strings s and t, which she considered very similar.... |
Solve the programming task below in a Python markdown code block.
Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color t_{i}.
For a fixed interval (set of consecutive elements) of b... |
Solve the programming task below in a Python markdown code block.
You are given an array $a$ consisting of $n$ integers. Initially all elements of $a$ are either $0$ or $1$. You need to process $q$ queries of two kinds:
1 x : Assign to $a_x$ the value $1 - a_x$.
2 k : Print the $k$-th largest value of the array.
As... |
Solve the programming task below in a Python markdown code block.
Snuke is standing on a two-dimensional plane. In one operation, he can move by 1 in the positive x-direction, or move by 1 in the positive y-direction.
Let us define a function f(r, c) as follows:
- f(r,c) := (The number of paths from the point (0, 0)... |
Solve the programming task below in a Python markdown code block.
Mislove had an array $a_1$, $a_2$, $\cdots$, $a_n$ of $n$ positive integers, but he has lost it. He only remembers the following facts about it:
The number of different numbers in the array is not less than $l$ and is not greater than $r$;
For eac... |
Solve the programming task below in a Python markdown code block.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring cities is exactly 1 km.
Sergey does not like beetles, he loves... |
Solve the programming task below in a Python markdown code block.
Phoenix is playing with a new puzzle, which consists of $n$ identical puzzle pieces. Each puzzle piece is a right isosceles triangle as shown below.
A puzzle piece
The goal of the puzzle is to create a square using the $n$ pieces. He is allowed to rot... |
Solve the programming task below in a Python markdown code block.
Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.
Given a sequence a consisting of n integers. The player can make several steps. In a single ste... |
Solve the programming task below in a Python markdown code block.
A word or a sentence in some language is called a pangram if all the characters of the alphabet of this language appear in it at least once. Pangrams are often used to demonstrate fonts in printing or test the output devices.
You are given a string con... |
Solve the programming task below in a Python markdown code block.
Smart Beaver decided to be not only smart, but also a healthy beaver! And so he began to attend physical education classes at school X. In this school, physical education has a very creative teacher. One of his favorite warm-up exercises is throwing bal... |
Solve the programming task below in a Python markdown code block.
Where do odds begin, and where do they end? Where does hope emerge, and will they ever break?
Given an integer sequence a_1, a_2, ..., a_{n} of length n. Decide whether it is possible to divide it into an odd number of non-empty subsegments, the each o... |
Solve the programming task below in a Python markdown code block.
The campus has $m$ rooms numbered from $0$ to $m - 1$. Also the $x$-mouse lives in the campus. The $x$-mouse is not just a mouse: each second $x$-mouse moves from room $i$ to the room $i \cdot x \mod{m}$ (in fact, it teleports from one room to another s... |
Solve the programming task below in a Python markdown code block.
You decide to develop a game with your friends. The title of the game is "Battle Town". This is a game with the theme of urban warfare with tanks. As the first step in game development, we decided to develop the following prototype.
In this prototype, ... |
Solve the programming task below in a Python markdown code block.
Two participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number that is present in both pairs. They want to figure out the number that matches by using a communication channel you have access to without reveal... |
Solve the programming task below in a Python markdown code block.
There are two rectangles.
The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B.
The lengths of the vertical sides of the second rectangle are C, and the lengths of the horiz... |
Solve the programming task below in a Python markdown code block.
There is a grid with N rows and N columns of squares. Let (i,j) be the square at the i-th row from the top and the j-th column from the left.
These squares have to be painted in one of the C colors from Color 1 to Color C. Initially, (i,j) is painted in... |
Solve the programming task below in a Python markdown code block.
There is a directed graph G with N vertices and M edges. The vertices are numbered 1, 2, \ldots, N, and for each i (1 \leq i \leq M), the i-th directed edge goes from Vertex x_i to y_i. G does not contain directed cycles.
Find the length of the longest... |
Solve the programming task below in a Python markdown code block.
There is a set A = \\{ a_1, a_2, \ldots, a_N \\} consisting of N positive integers. Taro and Jiro will play the following game against each other.
Initially, we have a pile consisting of K stones. The two players perform the following operation alterna... |
Solve the programming task below in a Python markdown code block.
This is the easy version of the problem. The only difference is that in this version q = 1. You can make hacks only if both versions of the problem are solved.
There is a process that takes place on arrays a and b of length n and length n-1 respectivel... |
Solve the programming task below in a Python markdown code block.
Blackjack is a type of card game played in casinos, where the game is played using cards with numbers from 1 to 13. The score of each card is decided as follows.
* 1 is 1 point or 11 points
* From 2 to 9, the score is as written.
* 10 points from 10 to... |
Solve the programming task below in a Python markdown code block.
A new innovative ticketing systems for public transport is introduced in Bytesburg. Now there is a single travel card for all transport. To make a trip a passenger scan his card and then he is charged according to the fare.
The fare is constructed in t... |
Solve the programming task below in a Python markdown code block.
Little Vasya's uncle is a postman. The post offices are located on one circular road. Besides, each post office has its own gas station located next to it. Petya's uncle works as follows: in the morning he should leave the house and go to some post offi... |
Solve the programming task below in a Python markdown code block.
Create a function that takes a string and an integer (`n`).
The function should return a string that repeats the input string `n` number of times.
If anything other than a string is passed in you should return `"Not a string"`
## Example
```
"Hi", ... |
Solve the programming task below in a Python markdown code block.
Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings lexicographically. The letters' case does not matte... |
Solve the programming task below in a Python markdown code block.
Alice and Bob play a game. They have a binary string $s$ (a string such that each character in it is either $0$ or $1$). Alice moves first, then Bob, then Alice again, and so on.
During their move, the player can choose any number (not less than one) o... |
Solve the programming task below in a Python markdown code block.
'Jeopardy!' is an intellectual game where players answer questions and earn points. Company Q conducts a simplified 'Jeopardy!' tournament among the best IT companies. By a lucky coincidence, the old rivals made it to the finals: company R1 and company ... |
Solve the programming task below in a Python markdown code block.
You are given a text consisting of $n$ space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after the last word. The length of text is the number of lette... |
Solve the programming task below in a Python markdown code block.
Polycarp was gifted an array $a$ of length $n$. Polycarp considers an array beautiful if there exists a number $C$, such that each number in the array occurs either zero or $C$ times. Polycarp wants to remove some elements from the array $a$ to make it ... |
Solve the programming task below in a Python markdown code block.
You have a string $s$ consisting of $n$ characters. Each character is either 0 or 1.
You can perform operations on the string. Each operation consists of two steps: select an integer $i$ from $1$ to the length of the string $s$, then delete the charac... |
Solve the programming task below in a Python markdown code block.
Draw a rectangle which has a height of H cm and a width of W cm. Draw a 1-cm square by single '#'.
Constraints
* 1 ≤ H ≤ 300
* 1 ≤ W ≤ 300
Input
The input consists of multiple datasets. Each dataset consists of two integers H and W separated by a si... |
Solve the programming task below in a Python markdown code block.
You are given an undirected graph consisting of $n$ vertices and $n$ edges. It is guaranteed that the given graph is connected (i. e. it is possible to reach any vertex from any other vertex) and there are no self-loops and multiple edges in the graph.
... |
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.
Chef has a positive integer N. He ... |
Solve the programming task below in a Python markdown code block.
G: Tree
problem
Given a tree consisting of N vertices. Each vertex of the tree is numbered from 1 to N. Of the N-1 edges, the i \ (= 1, 2, ..., N-1) edge connects the vertex u_i and the vertex v_i.
Write a program to find the number of K non-empty su... |
Solve the programming task below in a Python markdown code block.
Polycarp has an integer $n$ that doesn't contain the digit 0. He can do the following operation with his number several (possibly zero) times:
Reverse the prefix of length $l$ (in other words, $l$ leftmost digits) of $n$. So, the leftmost digit is swap... |
Solve the programming task below in a Python markdown code block.
$n$ boys and $m$ girls came to the party. Each boy presented each girl some integer number of sweets (possibly zero). All boys are numbered with integers from $1$ to $n$ and all girls are numbered with integers from $1$ to $m$. For all $1 \leq i \leq n$... |
Solve the programming task below in a Python markdown code block.
# Task
You are given a binary string (a string consisting of only '1' and '0'). The only operation that can be performed on it is a Flip operation.
It flips any binary character ( '0' to '1' and vice versa) and all characters to the `right` of it.
... |
Solve the programming task below in a Python markdown code block.
Daniel is organizing a football tournament. He has come up with the following tournament format: In the first several (possibly zero) stages, while the number of teams is even, they split in pairs and play one game for each pair. At each stage the los... |
Solve the programming task below in a Python markdown code block.
## Euler's Method
We want to calculate the shape of an unknown curve which starts at a given point
with a given slope. This curve satisfies an ordinary differential equation (ODE):
```math
\frac{dy}{dx} = f(x, y);\\
y(x_0) = y_0
```
The starting poi... |
Solve the programming task below in a Python markdown code block.
Catherine has a deck of n cards, each of which is either red, green, or blue. As long as there are at least two cards left, she can do one of two actions: take any two (not necessarily adjacent) cards with different colors and exchange them for a new ... |
Solve the programming task below in a Python markdown code block.
> Kyoto University Programming Contest is a programming contest voluntarily held by some Kyoto University students. This contest is abbreviated as Kyoto University Programming Contest and called KUPC.
>
> source: Kyoto University Programming Contest Inf... |
Solve the programming task below in a Python markdown code block.
A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward. Examples of numerical palindromes are:
* 232
* 110011
* 54322345
Complete the function to test if the given number (`num`) **can be rear... |
Solve the programming task below in a Python markdown code block.
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at... |
Solve the programming task below in a Python markdown code block.
After several latest reforms many tourists are planning to visit Berland, and Berland people understood that it's an opportunity to earn money and changed their jobs to attract tourists. Petya, for example, left the IT corporation he had been working fo... |
Solve the programming task below in a Python markdown code block.
Vasya's got a birthday coming up and his mom decided to give him an array of positive integers a of length n.
Vasya thinks that an array's beauty is the greatest common divisor of all its elements. His mom, of course, wants to give him as beautiful an ... |
Solve the programming task below in a Python markdown code block.
Malek has recently found a treasure map. While he was looking for a treasure he found a locked door. There was a string s written on the door consisting of characters '(', ')' and '#'. Below there was a manual on how to open the door. After spending a l... |
Solve the programming task below in a Python markdown code block.
One Martian boy called Zorg wants to present a string of beads to his friend from the Earth — Masha. He knows that Masha likes two colours: blue and red, — and right in the shop where he has come, there is a variety of adornments with beads of these two... |
Solve the programming task below in a Python markdown code block.
Along a road running in an east-west direction, there are A shrines and B temples.
The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i mete... |
Solve the programming task below in a Python markdown code block.
In this kata we want to convert a string into an integer. The strings simply represent the numbers in words.
Examples:
* "one" => 1
* "twenty" => 20
* "two hundred forty-six" => 246
* "seven hundred eighty-three thousand nine hundred and nineteen" => ... |
Solve the programming task below in a Python markdown code block.
Example
Input
7
>>
Output
7
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.
One day, at the "Russian Code Cup" event it was decided to play football as an out of competition event. All participants was divided into n teams and played several matches, two teams could not play against each other more than once.
The appointed Jud... |
Solve the programming task below in a Python markdown code block.
Today Patrick waits for a visit from his friend Spongebob. To prepare for the visit, Patrick needs to buy some goodies in two stores located near his house. There is a d_1 meter long road between his house and the first shop and a d_2 meter long road be... |
Solve the programming task below in a Python markdown code block.
On a random day, Neko found $n$ treasure chests and $m$ keys. The $i$-th chest has an integer $a_i$ written on it and the $j$-th key has an integer $b_j$ on it. Neko knows those chests contain the powerful mysterious green Grapes, thus Neko wants to ope... |
Solve the programming task below in a Python markdown code block.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visitor entered th... |
Solve the programming task below in a Python markdown code block.
Mr. Morishita was in trouble ... I had Mr. Anehara write a program, but the program crashed.
Mr. Anehara wrote a program that reads the formula in Reverse Polish Notation and outputs the calculation result. According to the crash log, it seems that the... |
Solve the programming task below in a Python markdown code block.
A class of students wrote a multiple-choice test.
There are $n$ students in the class. The test had $m$ questions, each of them had $5$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for qu... |
Solve the programming task below in a Python markdown code block.
After a hard quarter in the office you decide to get some rest on a vacation. So you will book a flight for you and your girlfriend and try to leave all the mess behind you.
You will need a rental car in order for you to get around in your vacation. Th... |
Solve the programming task below in a Python markdown code block.
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.
Most damage those strange creatures inflicted upon the king... |
Solve the programming task below in a Python markdown code block.
You are given three multisets of pairs of colored sticks: $R$ pairs of red sticks, the first pair has length $r_1$, the second pair has length $r_2$, $\dots$, the $R$-th pair has length $r_R$; $G$ pairs of green sticks, the first pair has length $g_1... |
Solve the programming task below in a Python markdown code block.
To celebrate the opening of the Winter Computer School the organizers decided to buy in n liters of cola. However, an unexpected difficulty occurred in the shop: it turned out that cola is sold in bottles 0.5, 1 and 2 liters in volume. At that, there ar... |
Solve the programming task below in a Python markdown code block.
Converting a 24-hour time like "0830" or "2030" to a 12-hour time (like "8:30 am" or "8:30 pm") sounds easy enough, right? Well, let's see if you can do it!
You will have to define a function named "to12hourtime", and you will be given a four digit ti... |
Solve the programming task below in a Python markdown code block.
One day Polycarp decided to rewatch his absolute favourite episode of well-known TV series "Tufurama". He was pretty surprised when he got results only for season 7 episode 3 with his search query of "Watch Tufurama season 3 episode 7 online full hd fre... |
Solve the programming task below in a Python markdown code block.
You are given a permutation p = (p_1, \ldots, p_N) of \\{ 1, \ldots, N \\}. You can perform the following two kinds of operations repeatedly in any order:
* Pay a cost A. Choose integers l and r (1 \leq l < r \leq N), and shift (p_l, \ldots, p_r) to th... |
Solve the programming task below in a Python markdown code block.
Hey CodeWarrior,
we've got a lot to code today!
I hope you know the basic string manipulation methods, because this kata will be all about them.
Here we go...
## Background
We've got a very long string, containing a bunch of User IDs. This string i... |
Solve the programming task below in a Python markdown code block.
Consider an N \times N matrix. Let us denote by a_{i, j} the entry in the i-th row and j-th column. For a_{i, j} where i=1 or j=1 holds, its value is one of 0, 1 and 2 and given in the input. The remaining entries are defined as follows:
- a_{i,j} = \m... |
Solve the programming task below in a Python markdown code block.
# One is the loneliest number
## Task
The range of vision of a digit is its own value. `1` can see one digit to the left and one digit to the right,` 2` can see two digits, and so on.
Thus, the loneliness of a digit `N` is the sum of the digits which... |
Solve the programming task below in a Python markdown code block.
You are given a set S of strings consisting of `0` and `1`, and an integer K.
Find the longest string that is a subsequence of K or more different strings in S. If there are multiple strings that satisfy this condition, find the lexicographically small... |
Solve the programming task below in a Python markdown code block.
Extended Euclid Algorithm
Given positive integers a and b, find the integer solution (x, y) to ax + by = gcd(a, b), where gcd(a, b) is the greatest common divisor of a and b.
Constraints
* 1 ≤ a, b ≤ 109
Input
a b
Two positive integers a and ... |
Solve the programming task below in a Python markdown code block.
T is playing a game with his friend, HL.
There are n piles of stones, the i-th pile initially has a_i stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone fr... |
Solve the programming task below in a Python markdown code block.
Ziota found a video game called "Monster Invaders".
Similar to every other shooting RPG game, "Monster Invaders" involves killing monsters and bosses with guns.
For the sake of simplicity, we only consider two different types of monsters and three dif... |
Solve the programming task below in a Python markdown code block.
Computer graphics uses polygon models as a way to represent three-dimensional shapes. A polygon model is a model that creates a surface by giving the coordinates of vertices and how to connect those vertices.
A general polygon model can handle any poly... |
Solve the programming task below in a Python markdown code block.
F: Miko Mi String-
story
Mikko Mikkomi ~! Everyone's idol, Miko Miko Tazawa! Today ~, with Mikoto ~, practice the string algorithm, let's do it ☆
Miko's special ~~ character making ~~ The slogan "MikoMikomi" becomes "MikoMikoMi" in Roman letters! In ... |
Solve the programming task below in a Python markdown code block.
[Image]
-----Input-----
The first line of the input is a string (between 1 and 50 characters long, inclusive). Each character will be a letter of English alphabet, lowercase or uppercase.
The second line of the input is an integer between 0 and 26,... |
Solve the programming task below in a Python markdown code block.
### Introduction and Warm-up (Highly recommended)
### [Playing With Lists/Arrays Series](https://www.codewars.com/collections/playing-with-lists-slash-arrays)
___
## Task
**_Given_** an *array/list [] of integers* , **_Find the product of the k maxim... |
Solve the programming task below in a Python markdown code block.
On his free time, Chouti likes doing some housework. He has got one new task, paint some bricks in the yard.
There are $n$ bricks lined in a row on the ground. Chouti has got $m$ paint buckets of different colors at hand, so he painted each brick in on... |
Solve the programming task below in a Python markdown code block.
On a weekend, Qingshan suggests that she and her friend Daniel go hiking. Unfortunately, they are busy high school students, so they can only go hiking on scratch paper.
A permutation $p$ is written from left to right on the paper. First Qingshan choos... |
Solve the programming task below in a Python markdown code block.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And. You can also move between (e, c-1) and (e, 0), and betwee... |
Solve the programming task below in a Python markdown code block.
Adding tip to a restaurant bill in a graceful way can be tricky, thats why you need make a function for it.
The function will receive the restaurant bill (always a positive number) as an argument. You need to 1) **add at least 15%** in tip, 2) round th... |
Solve the programming task below in a Python markdown code block.
There are 3N participants in AtCoder Group Contest. The strength of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams.
The strength of a tea... |
Solve the programming task below in a Python markdown code block.
We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares.
The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is 0, and white if S_{i,j} is 1.
We will cut the bar some n... |
Solve the programming task below in a Python markdown code block.
Find places where a string P is found within a text T. Print all indices of T where P found. The indices of T start with 0.
Constraints
* 1 ≤ length of T ≤ 1000
* 1 ≤ length of P ≤ 1000
* The input consists of alphabetical characters and digits
Input... |
Solve the programming task below in a Python markdown code block.
Ari the monster always wakes up very early with the first ray of the sun and the first thing she does is feeding her squirrel.
Ari draws a regular convex polygon on the floor and numbers it's vertices 1, 2, ..., n in clockwise order. Then starting from... |
Solve the programming task below in a Python markdown code block.
You are given a string $s$ consisting of $n$ characters. Each character of $s$ is either 0 or 1.
A substring of $s$ is a contiguous subsequence of its characters.
You have to choose two substrings of $s$ (possibly intersecting, possibly the same, poss... |
Solve the programming task below in a Python markdown code block.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of points on a plane.
Each of the next n lines contains two real coordinates x_{i} and y_{i} of the $i^{\text{th}}$ point, specified with exactly 2 fractional digit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.