question
large_stringlengths
265
13.2k
Solve the programming task below in a Python markdown code block. [Generala](https://en.wikipedia.org/wiki/Generala) is a dice game popular in South America. It's very similar to [Yahtzee](https://en.wikipedia.org/wiki/Yahtzee) but with a different scoring approach. It is played with 5 dice, and the possible results a...
Solve the programming task below in a Python markdown code block. Artem has an array of n positive integers. Artem decided to play with it. The game consists of n moves. Each move goes like this. Artem chooses some element of the array and removes it. For that, he gets min(a, b) points, where a and b are numbers that ...
Solve the programming task below in a Python markdown code block. Alice and Brown are brothers in a family and each receives pocket money in celebration of the coming year. They are very close and share the total amount of the money fifty-fifty. The pocket money each receives is a multiple of 1,000 yen. Write a progr...
Solve the programming task below in a Python markdown code block. An online contest will soon be held on ForceCoders, a large competitive programming platform. The authors have prepared $n$ problems; and since the platform is very popular, $998244351$ coder from all over the world is going to solve them. For each pro...
Solve the programming task below in a Python markdown code block. # Task You are given a car odometer which displays the miles traveled as an integer. The odometer has a defect, however: it proceeds from digit `3` to digit `5` always skipping the digit `4`. This defect shows up in all positions (ones, tens, hundr...
Solve the programming task below in a Python markdown code block. One very important person has a piece of paper in the form of a rectangle a × b. Also, he has n seals. Each seal leaves an impression on the paper in the form of a rectangle of the size x_{i} × y_{i}. Each impression must be parallel to the sides of th...
Solve the programming task below in a Python markdown code block. It's one more school day now. Sasha doesn't like classes and is always bored at them. So, each day he invents some game and plays in it alone or with friends. Today he invented one simple game to play with Lena, with whom he shares a desk. The rules ar...
Solve the programming task below in a Python markdown code block. In this Kata, you will be given a string and your task is to return the most valuable character. The value of a character is the difference between the index of its last occurrence and the index of its first occurrence. Return the character that has the...
Solve the programming task below in a Python markdown code block. How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? -----Constraints----- - 1≤M≤23 - M is an integer. -----Input----- Input is given from Standard Input in the following format: M -----Output----- If we have ...
Solve the programming task below in a Python markdown code block. Programmers' kids solve this riddle in 5-10 minutes. How fast can you do it? -----Input----- The input contains a single integer n (0 ≤ n ≤ 2000000000). -----Output----- Output a single integer. -----Examples----- Input 11 Output 2 Input 14 O...
Solve the programming task below in a Python markdown code block. On a two-dimensional plane, there are m lines drawn parallel to the x axis, and n lines drawn parallel to the y axis. Among the lines parallel to the x axis, the i-th from the bottom is represented by y = y_i. Similarly, among the lines parallel to the ...
Solve the programming task below in a Python markdown code block. You are given a tree consisting of $n$ vertices. A tree is an undirected connected acyclic graph. [Image] Example of a tree. You have to paint each vertex into one of three colors. For each vertex, you know the cost of painting it in every color. You...
Solve the programming task below in a Python markdown code block. Takahashi and Aoki will play a game using a grid with H rows and W columns of square cells. There are N obstacles on this grid; the i-th obstacle is at (X_i,Y_i). Here, we represent the cell at the i-th row and j-th column (1 \leq i \leq H, 1 \leq j \le...
Solve the programming task below in a Python markdown code block. While swimming at the beach, Mike has accidentally dropped his cellphone into the water. There was no worry as he bought a cheap replacement phone with an old-fashioned keyboard. The keyboard has only ten digital equal-sized keys, located in the followi...
Solve the programming task below in a Python markdown code block. Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to <image>. Then he measured the length of its sides, and found that each of them is equal to an integer number of centimeters. There the ...
Solve the programming task below in a Python markdown code block. The objective is to disambiguate two given names: the original with another Let's start simple, and just work with plain ascii strings. The function ```could_be``` is given the original name and another one to test against. ```python # should retur...
Solve the programming task below in a Python markdown code block. Limak is a little polar bear. He plays by building towers from blocks. Every block is a cube with positive integer length of side. Limak has infinitely many blocks of each side length. A block with side a has volume a^3. A tower consisting of blocks wi...
Solve the programming task below in a Python markdown code block. The only difference between easy and hard versions is constraints. You are given a sequence $a$ consisting of $n$ positive integers. Let's define a three blocks palindrome as the sequence, consisting of at most two distinct elements (let these element...
Solve the programming task below in a Python markdown code block. We'll define S(n) for positive integer n as follows: the number of the n's digits in the decimal base. For example, S(893) = 3, S(114514) = 6. You want to make a consecutive integer sequence starting from number m (m, m + 1, ...). But you need to pay S...
Solve the programming task below in a Python markdown code block. Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. 3:33 It's possible for all the digits displayed on a digital clock in the hours:minutes format to be identical. The time shown above (3:33) is an example of such a situation....
Solve the programming task below in a Python markdown code block. Little Elephant likes lemonade. When Little Elephant visits any room, he finds the bottle of the lemonade in that room that contains the greatest number of litres of lemonade and drinks it all. There are n rooms (numbered from 0 to n-1), each contains...
Solve the programming task below in a Python markdown code block. B: Twice as own problem You will be given Q queries. Since one positive integer N is given for each query, find the number of positive integers M that satisfy the following two conditions. * 2 Satisfy \ leq M \ leq N * Of the divisors of M, excluding...
Solve the programming task below in a Python markdown code block. This Christmas Santa gave Masha a magic picture and a pencil. The picture consists of n points connected by m segments (they might cross in any way, that doesn't matter). No two segments connect the same pair of points, and no segment connects the point...
Solve the programming task below in a Python markdown code block. The ABC number of a string T is the number of triples of integers (i, j, k) that satisfy all of the following conditions: - 1 ≤ i < j < k ≤ |T| (|T| is the length of T.) - T_i = A (T_i is the i-th character of T from the beginning.) - T_j = B - T_k ...
Solve the programming task below in a Python markdown code block. Gerald has n younger brothers and their number happens to be even. One day he bought n^2 candy bags. One bag has one candy, one bag has two candies, one bag has three candies and so on. In fact, for each integer k from 1 to n^2 he has exactly one bag wi...
Solve the programming task below in a Python markdown code block. You are given two positive integers $n$ and $s$. Find the maximum possible median of an array of $n$ non-negative integers (not necessarily distinct), such that the sum of its elements is equal to $s$. A median of an array of integers of length $m$ is ...
Solve the programming task below in a Python markdown code block. An n × n square matrix is special, if: it is binary, that is, each cell contains either a 0, or a 1; the number of ones in each row and column equals 2. You are given n and the first m rows of the matrix. Print the number of special n × n matrices, ...
Solve the programming task below in a Python markdown code block. Two integer sequences existed initially, one of them was strictly increasing, and another one — strictly decreasing. Strictly increasing sequence is a sequence of integers $[x_1 < x_2 < \dots < x_k]$. And strictly decreasing sequence is a sequence of i...
Solve the programming task below in a Python markdown code block. Maxim always goes to the supermarket on Sundays. Today the supermarket has a special offer of discount systems. There are m types of discounts. We assume that the discounts are indexed from 1 to m. To use the discount number i, the customer takes a spe...
Solve the programming task below in a Python markdown code block. You're given an integer N. Write a program to calculate the sum of all the digits of N. -----Input----- The first line contains an integer T, the total number of testcases. Then follow T lines, each line contains an integer N. -----Output----- For ...
Solve the programming task below in a Python markdown code block. There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood. Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the re...
Solve the programming task below in a Python markdown code block. There are N Snukes lining up in a row. You are given a string S of length N. The i-th Snuke from the front has two red balls if the i-th character in S is `0`; one red ball and one blue ball if the i-th character in S is `1`; two blue balls if the i-th ...
Solve the programming task below in a Python markdown code block. You are given a string $s$ of length $n$ consisting of lowercase Latin letters. You may apply some operations to this string: in one operation you can delete some contiguous substring of this string, if all letters in the substring you delete are equal....
Solve the programming task below in a Python markdown code block. One day Greg and his friends were walking in the forest. Overall there were n people walking, including Greg. Soon he found himself in front of a river. The guys immediately decided to get across the river. Luckily, there was a boat by the river bank, j...
Solve the programming task below in a Python markdown code block. Fox Ciel studies number theory. She thinks a non-empty set S contains non-negative integers is perfect if and only if for any $a, b \in S$ (a can be equal to b), $(a \text{xor} b) \in S$. Where operation xor means exclusive or operation (http://en.wiki...
Solve the programming task below in a Python markdown code block. You are given a rooted tree of $2^n - 1$ vertices. Every vertex of this tree has either $0$ children, or $2$ children. All leaves of this tree have the same distance from the root, and for every non-leaf vertex, one of its children is the left one, and ...
Solve the programming task below in a Python markdown code block. Johnny has just found the new, great tutorial: "How to become a grandmaster?". The tutorial tells many strange and unexpected for Johnny things, such as you have to be patient or that very important is solving many harder and harder problems. The boy ...
Solve the programming task below in a Python markdown code block. Scientists working internationally use metric units almost exclusively. Unless that is, they wish to crash multimillion dollars worth of equipment on Mars. Your task is to write a simple function that takes a number of meters, and outputs it using metr...
Solve the programming task below in a Python markdown code block. Vasya plays Robot Bicorn Attack. The game consists of three rounds. For each one a non-negative integer amount of points is given. The result of the game is the sum of obtained points. Vasya has already played three rounds and wrote obtained points one...
Solve the programming task below in a Python markdown code block. Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows. There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the...
Solve the programming task below in a Python markdown code block. You are given two integers $n$ and $m$. Calculate the number of pairs of arrays $(a, b)$ such that: the length of both arrays is equal to $m$; each element of each array is an integer between $1$ and $n$ (inclusive); $a_i \le b_i$ for any index $i$...
Solve the programming task below in a Python markdown code block. There are $n$ points on the plane, $(x_1,y_1), (x_2,y_2), \ldots, (x_n,y_n)$. You need to place an isosceles triangle with two sides on the coordinate axis to cover all points (a point is covered if it lies inside the triangle or on the side of the tri...
Solve the programming task below in a Python markdown code block. A super computer has been built in the Turtle Academy of Sciences. The computer consists of n·m·k CPUs. The architecture was the paralellepiped of size n × m × k, split into 1 × 1 × 1 cells, each cell contains exactly one CPU. Thus, each CPU can be simu...
Solve the programming task below in a Python markdown code block. Once upon a time there were several little pigs and several wolves on a two-dimensional grid of size n × m. Each cell in this grid was either empty, containing one little pig, or containing one wolf. A little pig and a wolf are adjacent if the cells th...
Solve the programming task below in a Python markdown code block. In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 10^9. At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all ...
Solve the programming task below in a Python markdown code block. Check if given chord is minor or major. _____________________________________________________________ Rules: 1. Basic minor/major chord have three elements. 2. Chord is minor when interval between first and second element equals 3 and between second ...
Solve the programming task below in a Python markdown code block. Polycarp has n dice d_1, d_2, ..., d_{n}. The i-th dice shows numbers from 1 to d_{i}. Polycarp rolled all the dice and the sum of numbers they showed is A. Agrippina didn't see which dice showed what number, she knows only the sum A and the values d_1,...
Solve the programming task below in a Python markdown code block. There is a factory that inputs the data of the side and diagonal lengths to the machine and cuts out the plastic plate. At this factory, we cut out only parallelogram molds, although they vary in size. You have been ordered by your boss to count the num...
Solve the programming task below in a Python markdown code block. As usual, Sereja has array a, its elements are integers: a[1], a[2], ..., a[n]. Let's introduce notation: <image> A swap operation is the following sequence of actions: * choose two indexes i, j (i ≠ j); * perform assignments tmp = a[i], a[i] = ...
Solve the programming task below in a Python markdown code block. You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of m...
Solve the programming task below in a Python markdown code block. Ayrat has number n, represented as it's prime factorization p_{i} of size m, i.e. n = p_1·p_2·...·p_{m}. Ayrat got secret information that that the product of all divisors of n taken modulo 10^9 + 7 is the password to the secret data base. Now he wants ...
Solve the programming task below in a Python markdown code block. One day, liouzhou_101 got a chat record of Freda and Rainbow. Out of curiosity, he wanted to know which sentences were said by Freda, and which were said by Rainbow. According to his experience, he thought that Freda always said "lala." at the end of he...
Solve the programming task below in a Python markdown code block. You are given two integers A and B. Find the largest value among A+B, A-B and A \times B. -----Constraints----- - -1000 \leq A,B \leq 1000 - All values in input are integers. -----Input----- Input is given from Standard Input in the following format...
Solve the programming task below in a Python markdown code block. After Misha's birthday he had many large numbers left, scattered across the room. Now it's time to clean up and Misha needs to put them in a basket. He ordered this task to his pet robot that agreed to complete the task at certain conditions. Before the...
Solve the programming task below in a Python markdown code block. You are given an array of integers. Vasya can permute (change order) its integers. He wants to do it so that as many as possible integers will become on a place where a smaller integer used to stand. Help Vasya find the maximal number of such integers. ...
Solve the programming task below in a Python markdown code block. Create a program that reads the sales unit price and sales quantity and outputs the total sales amount and the average sales quantity. Input The input is given in the following format: Sales unit price, sales quantity Sales unit price, sales quant...
Solve the programming task below in a Python markdown code block. Given is a tree T with N vertices. The i-th edge connects Vertex A_i and B_i (1 \leq A_i,B_i \leq N). Now, each vertex is painted black with probability 1/2 and white with probability 1/2, which is chosen independently from other vertices. Then, let S b...
Solve the programming task below in a Python markdown code block. Last summer Peter was at his granny's in the country, when a wolf attacked sheep in the nearby forest. Now he fears to walk through the forest, to walk round the forest, even to get out of the house. He explains this not by the fear of the wolf, but by ...
Solve the programming task below in a Python markdown code block. Alex is transitioning from website design to coding and wants to sharpen his skills with CodeWars. He can do ten kata in an hour, but when he makes a mistake, he must do pushups. These pushups really tire poor Alex out, so every time he does them they...
Solve the programming task below in a Python markdown code block. In this problem you are to calculate the sum of all integers from 1 to n, but you should take all powers of two with minus in the sum. For example, for n = 4 the sum is equal to - 1 - 2 + 3 - 4 = - 4, because 1, 2 and 4 are 2^0, 2^1 and 2^2 respectiv...
Solve the programming task below in a Python markdown code block. Berland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1, l2, ..., ln letters. Every word consisted of two letters, 0 and 1. Ancient Berland people spoke quickly and didn’t make pauses between the words, b...
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 maximum difference_**...
Solve the programming task below in a Python markdown code block. Leo has developed a new programming language C+=. In C+=, integer variables can only be changed with a "+=" operation that adds the right-hand side value to the left-hand side variable. For example, performing "a += b" when a = $2$, b = $3$ changes the ...
Solve the programming task below in a Python markdown code block. You are given a sorted array $a_1, a_2, \dots, a_n$ (for each index $i > 1$ condition $a_i \ge a_{i-1}$ holds) and an integer $k$. You are asked to divide this array into $k$ non-empty consecutive subarrays. Every element in the array should be include...
Solve the programming task below in a Python markdown code block. Alice is playing a game with her good friend, Marisa. There are n boxes arranged in a line, numbered with integers from 1 to n from left to right. Marisa will hide a doll in one of the boxes. Then Alice will have m chances to guess where the doll is. I...
Solve the programming task below in a Python markdown code block. In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller visits three cities ai, bi, ci in row, without visiting other...
Solve the programming task below in a Python markdown code block. Takahashi will play a game using a piece on an array of squares numbered 1, 2, \cdots, N. Square i has an integer C_i written on it. Also, he is given a permutation of 1, 2, \cdots, N: P_1, P_2, \cdots, P_N. Now, he will choose one square and place the ...
Solve the programming task below in a Python markdown code block. You have initially a string of N characters, denoted by A1,A2...AN. You have to print the size of the largest subsequence of string A such that all the characters in that subsequence are distinct ie. no two characters in that subsequence should be same....
Solve the programming task below in a Python markdown code block. You talked to Polycarp and asked him a question. You know that when he wants to answer "yes", he repeats Yes many times in a row. Because of the noise, you only heard part of the answer — some substring of it. That is, if he answered YesYes, then you c...
Solve the programming task below in a Python markdown code block. There are n psychos standing in a line. Each psycho is assigned a unique integer from 1 to n. At each step every psycho who has an id greater than the psycho to his right (if exists) kills his right neighbor in the line. Note that a psycho might kill an...
Solve the programming task below in a Python markdown code block. Mr. Matsudaira is always careful about eco-friendliness in his life. Last month's water charge was 4280 yen, which exceeded the usual target of 4000 yen, so we have been trying to save water this month. How much have you saved on your water bill compare...
Solve the programming task below in a Python markdown code block. You are given n k-digit integers. You have to rearrange the digits in the integers so that the difference between the largest and the smallest number was minimum. Digits should be rearranged by the same rule in all integers. Input The first line conta...
Solve the programming task below in a Python markdown code block. Let's consider all integers in the range from $1$ to $n$ (inclusive). Among all pairs of distinct integers in this range, find the maximum possible greatest common divisor of integers in pair. Formally, find the maximum value of $\mathrm{gcd}(a, b)$, w...
Solve the programming task below in a Python markdown code block. Bamboo Blossoms The bamboos live for decades, and at the end of their lives, they flower to make their seeds. Dr. ACM, a biologist, was fascinated by the bamboos in blossom in his travel to Tsukuba. He liked the flower so much that he was tempted to ma...
Solve the programming task below in a Python markdown code block. There is a knight - the chess piece - at the origin (0, 0) of a two-dimensional grid. When the knight is at the square (i, j), it can be moved to either (i+1,j+2) or (i+2, j+1). In how many ways can the knight reach the square (X, Y)? Find the number of...
Solve the programming task below in a Python markdown code block. Alas, finding one's true love is not easy. Masha has been unsuccessful in that yet. Her friend Dasha told Masha about a way to determine the phone number of one's Prince Charming through arithmancy. The phone number is divined like that. First one nee...
Solve the programming task below in a Python markdown code block. I am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all of the same size (2 m in width, 1 m in height) and the wall...
Solve the programming task below in a Python markdown code block. A rabbit who came to the fair found that the prize for a game at a store was a carrot cake. The rules for this game are as follows. There is a grid-like field of vertical h squares x horizontal w squares, and each block has at most one block. Each bloc...
Solve the programming task below in a Python markdown code block. Given an array, return the difference between the count of even numbers and the count of odd numbers. `0` will be considered an even number. ``` For example: solve([0,1,2,3]) = 0 because there are two even numbers and two odd numbers. Even - Odd = 2 -...
Solve the programming task below in a Python markdown code block. Mr. Infinity has a string S consisting of digits from 1 to 9. Each time the date changes, this string changes as follows: - Each occurrence of 2 in S is replaced with 22. Similarly, each 3 becomes 333, 4 becomes 4444, 5 becomes 55555, 6 becomes 666666,...
Solve the programming task below in a Python markdown code block. _This kata is based on [Project Euler Problem 546](https://projecteuler.net/problem=546)_ # Objective Given the recursive sequence fk(n) = ∑ i = 0 n fk(floor(i / k)) where fk(0) = 1 Define a function `f` that takes arguments `k` and `n` and...
Solve the programming task below in a Python markdown code block. Summer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrix a with n lines and m columns. Let number a[i][j] represents the calories burned by performing workout at the ce...
Solve the programming task below in a Python markdown code block. Write a simple regex to validate a username. Allowed characters are: - lowercase letters, - numbers, - underscore Length should be between 4 and 16 characters (both included). Read the inputs from stdin solve the problem and write the answer to stdou...
Solve the programming task below in a Python markdown code block. Formula 1 officials decided to introduce new competition. Cars are replaced by space ships and number of points awarded can differ per race. Given the current ranking in the competition and points distribution for the next race, your task is to calcula...
Solve the programming task below in a Python markdown code block. Oranges on Cans square1001 You put a $ N $ can of aluminum on the table. E869120 You put $ M $ of oranges on each aluminum can on the table. How many oranges are on the aluminum can? input Input is given from standard input in the following format....
Solve the programming task below in a Python markdown code block. There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. Here, h_1 < h_2 < \cdots < h_N holds. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to rea...
Solve the programming task below in a Python markdown code block. Goal Given a list of elements [a1, a2, ..., an], with each ai being a string, write a function **majority** that returns the value that appears the most in the list. If there's no winner, the function should return None, NULL, nil, etc, based on the p...
Solve the programming task below in a Python markdown code block. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No two friends h...
Solve the programming task below in a Python markdown code block. Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years. There are two sequences of $n$ st...
Solve the programming task below in a Python markdown code block. Recently personal training sessions have finished in the Berland State University Olympiad Programmer Training Centre. By the results of these training sessions teams are composed for the oncoming team contest season. Each team consists of three people....
Solve the programming task below in a Python markdown code block. According to ISO 8601, the first calendar week (1) starts with the week containing the first thursday in january. Every year contains of 52 (53 for leap years) calendar weeks. **Your task is** to calculate the calendar week (1-53) from a given date. Fo...
Solve the programming task below in a Python markdown code block. You are given an array $a_1, a_2, \dots, a_n$ where all $a_i$ are integers and greater than $0$. In one operation, you can choose two different indices $i$ and $j$ ($1 \le i, j \le n$). If $gcd(a_i, a_j)$ is equal to the minimum element of the whole a...
Solve the programming task below in a Python markdown code block. The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d_1 is the distance between the 1-st and the 2-nd station; d_2 is the distance between the 2-nd and the 3-rd station; ... d_{...
Solve the programming task below in a Python markdown code block. You are given a sequence of $n$ integers $a_1, \, a_2, \, \dots, \, a_n$. Does there exist a sequence of $n$ integers $b_1, \, b_2, \, \dots, \, b_n$ such that the following property holds? For each $1 \le i \le n$, there exist two (not necessarily di...
Solve the programming task below in a Python markdown code block. In this problem you have to simulate the workflow of one-thread server. There are n queries to process, the i-th will be received at moment t_{i} and needs to be processed for d_{i} units of time. All t_{i} are guaranteed to be distinct. When a query a...
Solve the programming task below in a Python markdown code block. You play a strategic video game (yeah, we ran out of good problem legends). In this game you control a large army, and your goal is to conquer $n$ castles of your opponent. Let's describe the game process in detail. Initially you control an army of $k$...
Solve the programming task below in a Python markdown code block. We have three boxes A, B, and C, each of which contains an integer. Currently, the boxes A, B, and C contain the integers X, Y, and Z, respectively. We will now do the operations below in order. Find the content of each box afterward. - Swap the co...
Solve the programming task below in a Python markdown code block. You drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i. How many kinds of items did you get? -----Constraints----- - 1 \leq N \leq 2\times 10^5 - S_i consists of lowercase English letters and has a length ...
Solve the programming task below in a Python markdown code block. Today, Wet Shark is given n integers. Using any of these integers no more than once, Wet Shark wants to get maximum possible even (divisible by 2) sum. Please, calculate this value for Wet Shark. Note, that if Wet Shark uses no integers from the n int...
Solve the programming task below in a Python markdown code block. Once when Gerald studied in the first year at school, his teacher gave the class the following homework. She offered the students a string consisting of n small Latin letters; the task was to learn the way the letters that the string contains are writte...