task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Arkady decided to buy roses for his girlfriend. A flower shop has white, orange and red roses, and the total amount of them is n. Arkady thinks that red roses are not good together with white roses, so he won't buy a bouquet containing both red and white roses. Also, Arkady won't buy a bouquet where all roses have the...
24,600
You are given a grid of N rows and M columns. The square at the i-th row and j-th column will be denoted as (i,j). A nonnegative integer A_{i,j} is written for each square (i,j). You choose some of the squares so that each row and column contains at most K chosen squares. Under this constraint, calculate the maximum v...
24,601
Given a tree with n nodes numbered from 1 to n. Each node i has an associated value V_i. If the simple path from u_1 to u_m consists of m nodes namely u_1 → u_2 → u_3 → ... u_{m-1} → u_{m}, then its alternating function A(u_{1},u_{m}) is defined as A(u_{1},u_{m}) = ∑_{i=1}^{m} (-1)^{i+1} ⋅ V_{u_{i}}. A path can also h...
24,602
Roger is a robot. He has an arm that is a series of n segments connected to each other. The endpoints of the i-th segment are initially located at points (i - 1, 0) and (i, 0). The endpoint at (i - 1, 0) is colored red and the endpoint at (i, 0) is colored blue for all segments. Thus, the blue endpoint of the i-th segm...
24,603
"It all started with a kiss." Chotu was up all night, planning for his first kiss. He has collected the data about all the kissing spots in Allahabad. According to his survey there are N kissing spots in the city, each spot i is associated with a security value Si. Chotu wants to visit as many spot as they can, but un...
24,604
problem There is a mysterious device $ M $, and if you put Tanuki and Fox in this device, one animal will come out from the device (hereinafter, Tanuki will be $ T $ and Fox will be $ F $). $ M (x, y) $ represents an animal that came out by putting animals in the device $ M $ in the order of $ x, y $. As a result of...
24,605
There are N strings arranged in a row. It is known that, for any two adjacent strings, the string to the left is lexicographically smaller than the string to the right. That is, S_1<S_2<...<S_N holds lexicographically, where S_i is the i-th string from the left. At least how many different characters are contained in ...
24,606
George has recently entered the BSUCP (Berland State University for Cool Programmers). George has a friend Alex who has also entered the university. Now they are moving into a dormitory. George and Alex want to live in the same room. The dormitory has n rooms in total. At the moment the i-th room has pi people living...
24,607
Given two vessels, one of which can accommodate a liters of water and the other which can accommodate b liters of water, determine the number of steps required to obtain exactly c liters of water in one of the vessels. At the beginning both vessels are empty. The following operations are counted as 'steps': emptying...
24,608
You are planning to create a map of an RPG. This map is represented by a grid whose size is $H \times W$. Each cell in this grid is either '@', '*', '#', or '.'. The meanings of the symbols are as follows. * '@': The start cell. The story should start from this cell. * '*': A city cell. The story goes through or ends ...
24,609
The goal of the 15 puzzle problem is to complete pieces on $4 \times 4$ cells where one of the cells is empty space. In this problem, the space is represented by 0 and pieces are represented by integers from 1 to 15 as shown below. 1 2 3 4 6 7 8 0 5 10 11 12 9 13 14 15 You can move a piece toward the empty space a...
24,610
Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X. Constraints * 1 \leq X \leq 10^9 * X is an integer. * There exists a pair of integers (A, B) satisfying the condition in Problem Statement. Input Input is given from Standard Input in the fo...
24,611
In the year 2168, AtCoder Inc., which is much larger than now, is starting a limited express train service called AtCoder Express. In the plan developed by the president Takahashi, the trains will run as follows: * A train will run for (t_1 + t_2 + t_3 + ... + t_N) seconds. * In the first t_1 seconds, a train must ru...
24,612
The secret services of Armin, an otherwise peace-loving country, have decided to perform a surgical strike in the war-torn city of Tashka. Tashka is under enemy control and the objective of the strike is to gain control over the city. The mission is subdivided into the following steps: 1) Divide in groups and infiltra...
24,613
There are n cities located along the one-way road. Cities are numbered from 1 to n in the direction of the road. The i-th city had produced pi units of goods. No more than si units of goods can be sold in the i-th city. For each pair of cities i and j such that 1 ≤ i < j ≤ n you can no more than once transport no mor...
24,614
There are n students in a class working on group projects. The students will divide into groups (some students may be in groups alone), work on their independent pieces, and then discuss the results together. It takes the i-th student ai minutes to finish his/her independent piece. If students work at different paces,...
24,615
Rachel, being an awesome android programmer, just finished an App that will let us draw a triangle by selecting three points on the touch-plane.Now She asks her friend Bruce to draw a Right-Angled Triangle (we'll call it RAT) by selecting 3 integral points on the plane. A RAT is a triangle with Non-Zero area and a rig...
24,616
An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at m...
24,617
In Gregorian calendar a typical year consists of 365 days and 12 months. The numbers of days in the months are: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31. If year index is divisible by 400, or divisible by 4 but not by 100, the year becomes leap year, with one extra day in the second month (the one which typically...
24,618
Bob likes to draw camels: with a single hump, two humps, three humps, etc. He draws a camel by connecting points on a coordinate plane. Now he's drawing camels with t humps, representing them as polylines in the plane. Each polyline consists of n vertices with coordinates (x1, y1), (x2, y2), ..., (xn, yn). The first ve...
24,619
The JAG Kingdom consists of $N$ cities and $M$ bidirectional roads. The $i$-th road ($u_i, v_i, c_i$) connects the city $u_i$ and the city $v_i$ with the length $c_i$. One day, you, a citizen of the JAG Kingdom, decided to go to the city $T$ from the city $S$. However, you know that one of the roads in the JAG Kingdom ...
24,620
Seeing the fame received by the Fibonacci numbers, the other Natural Numbers were feeling jealous. Therefore, to give them their shot at glory Mr. Non-Fibo now wants you to tell him the N^th- Non Fibonacci Number. Input: First line contains T which is the number of test cases. T lines follow each with an integer N. O...
24,621
We call a function good if its domain of definition is some set of integers and if in case it's defined in x and x-1, f(x) = f(x-1) + 1 or f(x) = f(x-1). Tanya has found n good functions f_{1}, …, f_{n}, which are defined on all integers from 0 to 10^{18} and f_i(0) = 0 and f_i(10^{18}) = L for all i from 1 to n. It's...
24,622
C: Shopping-Shopping- story Isono's older sister, Sazoe, decided to cook dinner for Isono and Nakajima, who are playing "that" and "that". Unfortunately, there are only a few ingredients left in the refrigerator, so Sazoe decided to go shopping. Mr. Sazoe is trying to buy some ingredients, but he is so cheerful that ...
24,623
Here is a very simple variation of the game backgammon, named “Minimal Backgammon”. The game is played by only one player, using only one of the dice and only one checker (the token used by the player). The game board is a line of (N + 1) squares labeled as 0 (the start) to N (the goal). At the beginning, the checker ...
24,624
You are given a integer n (n > 0). Find any integer s which satisfies these conditions, or report that there are no such numbers: In the decimal representation of s: * s > 0, * s consists of n digits, * no digit in s equals 0, * s is not divisible by any of it's digits. Input The input consists of mult...
24,625
Polar bears like unique arrays — that is, arrays without repeated elements. You have got a unique array s with length n containing non-negative integers. Since you are good friends with Alice and Bob, you decide to split the array in two. Precisely, you need to construct two arrays a and b that are also of length n, w...
24,626
You are given an array a consisting of n positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset. Both the given array and required subset may contain equal values. Input The first line contains a single integer t (1 ≤ t ≤...
24,627
Balance strings, by definition, are the strings that contain all the characters of the alphabet, from a to z, equal no of times. eg- abcdefghijklmnopqrstuvwxyz is a balanced string, aabb is not. Input: First line contains number of test cases T. Each test case contains a string S which made up of only lowercase charac...
24,628
Bishwock is a chess figure that consists of three squares resembling an "L-bar". This figure can be rotated by 90, 180 and 270 degrees so it can have four possible states: XX XX .X X. X. .X XX XX Bishwocks don't attack any squares and can even occupy on the adjacent square...
24,629
Polycarpus is the director of a large corporation. There are n secretaries working for the corporation, each of them corresponds via the famous Spyke VoIP system during the day. We know that when two people call each other via Spyke, the Spyke network assigns a unique ID to this call, a positive integer session number....
24,630
Please pay attention to the unusual memory limit in this problem. In a parallel universe, Satan is called "Trygub". For that reason, the letters of his namesake were deleted from the alphabet in ancient times. The government has n workers standing in a row and numbered with integers from 1 to n from left to right. Th...
24,631
Development of Small Flying Robots <image> You are developing small flying robots in your laboratory. The laboratory is a box-shaped building with K levels, each numbered 1 through K from bottom to top. The floors of all levels are square-shaped with their edges precisely aligned east-west and north-south. Each floo...
24,632
In the Jambo Amusement Garden (JAG), you sell colorful drinks consisting of multiple color layers. This colorful drink can be made by pouring multiple colored liquids of different density from the bottom in order. You have already prepared several colored liquids with various colors and densities. You will receive a d...
24,633
ZS the Coder and Chris the Baboon are travelling to Udayland! To get there, they have to get on the special IOI bus. The IOI bus has n rows of seats. There are 4 seats in each row, and the seats are separated into pairs by a walkway. When ZS and Chris came, some places in the bus was already occupied. ZS and Chris are...
24,634
You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. <image> An example of a trapezoid Find the area of this trapezoid. Constraints * 1≦a≦100 * 1≦b≦100 * 1≦h≦100 * All input values are integers. * h is even. Input The input is given from Standard Input i...
24,635
There are four stones on an infinite line in integer coordinates a_1, a_2, a_3, a_4. The goal is to have the stones in coordinates b_1, b_2, b_3, b_4. The order of the stones does not matter, that is, a stone from any position a_i can end up in at any position b_j, provided there is a required number of stones in each ...
24,636
E: Red Black Balloons Story Homura-chan's dream comes true. It means ICPC Asia regional contest 20xx will be held in Sapporo! Homura-chan has been working hard for the preparation. And finally, it's the previous day of the contest. Homura-chan started to stock balloons to be delivered to contestants who get accepted....
24,637
Help Saurabh with his Chemistry Assignment. Saurabh has been given a chemistry assignment by Ruby Mam. Though the assignment is simple but Saurabh has to watch India vs Pakistan Match and he has no time to do the assignment by himself. So Saurabh wants you to do his assignment so that he doesn’t get scolded by Ruby Mam...
24,638
Marmot found a row with n pillars. The i-th pillar has the height of hi meters. Starting from one pillar i1, Marmot wants to jump on the pillars i2, ..., ik. (1 ≤ i1 < i2 < ... < ik ≤ n). From a pillar i Marmot can jump on a pillar j only if i < j and |hi - hj| ≥ d, where |x| is the absolute value of the number x. Now...
24,639
You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starting cell is in the row r and column c. In one step you can move one square up, left, down or right, if the target cell is not o...
24,640
Suppose you have a string S which has length N and is indexed from 0 to N−1. String R is the reverse of the string S. The string S is funny if the condition |Si−Si−1|=|Ri−Ri−1| is true for every i from 1 to N−1. (Note: Given a string str, stri denotes the ascii value of the ith character (0-indexed) of str. |x| denote...
24,641
As we know, DZY loves playing games. One day DZY decided to play with a n × m matrix. To be more precise, he decided to modify the matrix with exactly k operations. Each modification is one of the following: 1. Pick some row of the matrix and decrease each element of the row by p. This operation brings to DZY the v...
24,642
There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. Constraints * 1 \leq S \leq 100 * 1 \leq W \leq 100 Input Input is given from Standard Input in the fol...
24,643
This problem is interactive. You should guess hidden number x which is between 1 and M = 10004205361450474, inclusive. You could use up to 5 queries. In each query, you can output an increasing sequence of k ≤ x integers, each between 1 and M, inclusive, and you will obtain one of the following as an answer: * ei...
24,644
There are many ways to order a list of integers from 1 to n. For example, if n = 3, the list could be : [3\; 1\; 2]. But there is a special way to create another list from the given list of integers. In this list, position of integer i is the i-th number in the given list. So following this rule, the given list will ...
24,645
Vasya has recently bought some land and decided to surround it with a wooden fence. He went to a company called "Wooden board" that produces wooden boards for fences. Vasya read in the catalog of products that the company has at its disposal n different types of wood. The company uses the i-th type of wood to produce ...
24,646
The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I would like to see if I can make a rectangular parallelepiped using the 12 sticks I prepared. However, the stick must not be cut or...
24,647
One drew a closed polyline on a plane, that consisted only of vertical and horizontal segments (parallel to the coordinate axes). The segments alternated between horizontal and vertical ones (a horizontal segment was always followed by a vertical one, and vice versa). The polyline did not contain strict self-intersecti...
24,648
Example Input 3 NNN NNN NNN Output Taro
24,649
Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well. Today's training is to improve reflexes and memory by performing whac-a-mole many times. I want to hit the moles that come out one after another and get as many points as possible. The p...
24,650
Rajat is a guy who always wants to live in a fantasy world. In his world, a deck consists of X cards, where X is a multiple of 4. There are four types of cards namely spade , heart , club and diamond with each type having values in range of [1,X/4] inclusive. His cousin wants to test him. So,to test Rajat , his cousin...
24,651
You will participate in the ski competition held on Mt. Bandai. In this competition, each player slides down the slope twice and competes for the short total time. There are several flags on the slopes, and a line is set between them for athletes to pass through. Athletes slide down the line from the start point to the...
24,652
Call a number stepping if adjacent digits, as well as the first and last digits, differ by one. How many n-digit base 11 stepping numbers are there? Give your answer modulo 4294967143. For example, 8789A9 is a 6-digit base 11 stepping number. 9A0A and 234 are not stepping. Input The first line contains an integer T,...
24,653
There is a matrix A of size x × y filled with integers. For every <image>, <image> Ai, j = y(i - 1) + j. Obviously, every integer from [1..xy] occurs exactly once in this matrix. You have traversed some path in this matrix. Your path can be described as a sequence of visited cells a1, a2, ..., an denoting that you st...
24,654
There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i. For each square, you will perform either of the following operations once: * Decrease the height of the square by 1. * Do nothing. Determine if it is possible to perform the operations so that the heights ...
24,655
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations. Constraints...
24,656
You are given a permutation p_1, p_2, …, p_n. In one move you can swap two adjacent values. You want to perform a minimum number of moves, such that in the end there will exist a subsegment 1,2,…, k, in other words in the end there should be an integer i, 1 ≤ i ≤ n-k+1 such that p_i = 1, p_{i+1} = 2, …, p_{i+k-1}=k. ...
24,657
Let us compare two triples a = (xa, ya, za) and b = (xb, yb, zb) by a partial order ∠ defined as follows. a ∠ b ⇔ xa < xb and ya < yb and za < zb Your mission is to find, in the given set of triples, the longest ascending series a1 ∠ a2 ∠ ... ∠ ak. Input The input is a sequence of datasets, each specifying a set...
24,658
Sereja has m non-empty sets of integers A1, A2, ..., Am. What a lucky coincidence! The given sets are a partition of the set of all integers from 1 to n. In other words, for any integer v (1 ≤ v ≤ n) there is exactly one set At such that <image>. Also Sereja has integer d. Sereja decided to choose some sets from the s...
24,659
Extraterrestrial Life Genome Database Returns In 2301 AD, the Department of Life Sciences of the Federal Republic of Space was studying the genome sequences of space organisms. As a result of recent research, it has become clear that the number of times a specific pattern appears in the genome sequence has a great inf...
24,660
During the winter holidays, the demand for Christmas balls is exceptionally high. Since it's already 2018, the advances in alchemy allow easy and efficient ball creation by utilizing magic crystals. Grisha needs to obtain some yellow, green and blue balls. It's known that to produce a yellow ball one needs two yellow ...
24,661
The Fair Nut lives in n story house. a_i people live on the i-th floor of the house. Every person uses elevator twice a day: to get from the floor where he/she lives to the ground (first) floor and to get from the first floor to the floor where he/she lives, when he/she comes back home in the evening. It was decided ...
24,662
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers). The key in football is to divide into teams fairly before the ...
24,663
Limak is a little polar bear. He doesn't have many toys and thus he often plays with polynomials. He considers a polynomial valid if its degree is n and its coefficients are integers not exceeding k by the absolute value. More formally: Let a0, a1, ..., an denote the coefficients, so <image>. Then, a polynomial P(x) ...
24,664
Berland SU holds yet another training contest for its students today. n students came, each of them brought his laptop. However, it turned out that everyone has forgot their chargers! Let students be numbered from 1 to n. Laptop of the i-th student has charge a_i at the beginning of the contest and it uses b_i of char...
24,665
Arpa is researching the Mexican wave. There are n spectators in the stadium, labeled from 1 to n. They start the Mexican wave at time 0. * At time 1, the first spectator stands. * At time 2, the second spectator stands. * ... * At time k, the k-th spectator stands. * At time k + 1, the (k + 1)-th specta...
24,666
There are N towns numbered 1, 2, \cdots, N. Some roads are planned to be built so that each of them connects two distinct towns bidirectionally. Currently, there are no roads connecting towns. In the planning of construction, each town chooses one town different from itself and requests the following: roads are built...
24,667
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string S...
24,668
While dad was at work, a little girl Tanya decided to play with dad's password to his secret database. Dad's password is a string consisting of n + 2 characters. She has written all the possible n three-letter continuous substrings of the password on pieces of paper, one for each piece of paper, and threw the password ...
24,669
You are given n non-decreasing arrays of non-negative numbers. Vasya repeats the following operation k times: * Selects a non-empty array. * Puts the first element of the selected array in his pocket. * Removes the first element from the selected array. Vasya wants to maximize the sum of the elements in...
24,670
There is a kingdom, that has a long straight road of length L meters and width 0. Coordinate x on the road denotes point that is at x meters from the start of the road. That is coordinate 0 denotes beginning of the road and coordinate L denotes end of the road. The road has to be painted with color. There are K proposa...
24,671
Chef loves palindromes. Chef initially has odd number of charachters. Chef wants to create a palindrome of maximum even length using these characters. For this Chef needs to discard one character. Help Chef find the character which needs to be discarded so that he can use the rest characters in any order to form a pali...
24,672
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 merged together into one large square. The top left square is colored w...
24,673
It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin. We can think Central Perk as coordinate plane. There are n bottles on the ground, the i-th bottle is located at position (xi, yi). Both Adil and Bera can c...
24,674
Celebrating the new year, many people post videos of falling dominoes; Here's a list of them: https://www.youtube.com/results?search_query=New+Years+Dominos User ainta, who lives in a 2D world, is going to post a video as well. There are n dominoes on a 2D Cartesian plane. i-th domino (1 ≤ i ≤ n) can be represented a...
24,675
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large). Killjoy's account is already infected and has a rating equal to x. Its rating is constant. There are n accounts except hers, number...
24,676
Darth Vader, the lord of the dark side has created a Death-Star (it can destroy any star). You have to deactivate the Death-star. To deactivate the death-star one must find the unique most powerful Lightsaber. Lightsaber’s power is associated with a number. You ask for Lightsaber from your friendly Jedis(person). You...
24,677
The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves permitted for the king. Check the king's moves here https://en.wikipedia.org/wiki/King_(chess). <image> King moves from the posi...
24,678
This is a harder version of the problem E with larger constraints. Twilight Sparkle has received a new task from Princess Celestia. This time she asked to decipher the ancient scroll containing important knowledge of pony origin. To hide the crucial information from evil eyes, pony elders cast a spell on the scroll. ...
24,679
Xenia lives in a city that has n houses built along the main ringroad. The ringroad houses are numbered 1 through n in the clockwise order. The ringroad traffic is one way and also is clockwise. Xenia has recently moved into the ringroad house number 1. As a result, she's got m things to do. In order to complete the i...
24,680
Snuke has two boards, each divided into a grid with N rows and N columns. For both of these boards, the square at the i-th row from the top and the j-th column from the left is called Square (i,j). There is a lowercase English letter written in each square on the first board. The letter written in Square (i,j) is S_{i...
24,681
Vasya studies positional numeral systems. Unfortunately, he often forgets to write the base of notation in which the expression is written. Once he saw a note in his notebook saying a + b = ?, and that the base of the positional notation wasn’t written anywhere. Now Vasya has to choose a base p and regard the expressio...
24,682
Please note that the memory limit differs from the standard. You really love to listen to music. During the each of next s days you will listen to exactly m songs from the playlist that consists of exactly n songs. Let's number the songs from the playlist with numbers from 1 to n, inclusive. The quality of song number...
24,683
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
24,684
Nick has some permutation consisting of p integers from 1 to n. A segment [l, r] (l ≤ r) is a set of elements pi satisfying l ≤ i ≤ r. Nick calls a pair of segments [a0, a1] and [b0, b1] (1 ≤ a0 ≤ a1 < b0 ≤ b1 ≤ n) good if all their (a1 - a0 + b1 - b0 + 2) elements, when sorted in ascending order, form an arithmetic p...
24,685
Zane once had a good sequence a consisting of n integers a1, a2, ..., an — but he has lost it. A sequence is said to be good if and only if all of its integers are non-negative and do not exceed 109 in value. <image> However, Zane remembers having played around with his sequence by applying m operations to it. Ther...
24,686
Consider a set of points A, initially it is empty. There are three types of queries: 1. Insert a point (x_i, y_i) to A. It is guaranteed that this point does not belong to A at this moment. 2. Remove a point (x_i, y_i) from A. It is guaranteed that this point belongs to A at this moment. 3. Given a point (x_i...
24,687
Our Chef is very happy that his son was selected for training in one of the finest culinary schools of the world. So he and his wife decide to buy a gift for the kid as a token of appreciation. Unfortunately, the Chef hasn't been doing good business lately, and is in no mood on splurging money. On the other hand, the b...
24,688
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. Organizers always pick an abbreviation with non-empty string y that has never been used before. Amo...
24,689
There are n games in a football tournament. Three teams are participating in it. Currently k games had already been played. You are an avid football fan, but recently you missed the whole k games. Fortunately, you remember a guess of your friend for these k games. Your friend did not tell exact number of wins of each...
24,690
Problem Satake doesn't like being bent. For example, I don't like pencils, chopsticks, and bent-shaped houses, and I don't like taking actions such as turning right or left. By the way, Satake who lives on the XY plane is $ N $ shops $ (X_ {1}, Y_ {1}), (X_ {2}, Y_ {2}), \ ldots, (X_ {N} , Y_ {N}) I was asked to shop...
24,691
You are given a uniformly randomly generated string S, consisting of letters from the set {"A", "B"}. Your task is to find a string T that appears in S as a subsequence exactly twice. In other words, you need to find such a string T, that there exist exactly two sets of indexes i1, i2, ..., i|T| and j1, j2, ..., j|T| s...
24,692
Vasya likes to solve equations. Today he wants to solve (x~div~k) ⋅ (x mod k) = n, where div and mod stand for integer division and modulo operations (refer to the Notes below for exact definition). In this equation, k and n are positive integer parameters, and x is a positive integer unknown. If there are several solu...
24,693
Mr. A is planning to travel alone on a highway bus (hereinafter referred to as "bus") during his high school holidays. First, Mr. A chose the town he wanted to visit the most and made it his destination. Next, you have to decide the route to transfer the bus from the departure point to the destination. When connecting,...
24,694
You are given an array a consisting of n integers. You can remove at most one element from this array. Thus, the final length of the array is n-1 or n. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subarray a wi...
24,695
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures). There are n members, numbered 1 through n. m pairs of members are friends. Of course, a member can't be a friend with themselves. Let A-B denote that membe...
24,696
You are given a list of names. Your task is to find all the distinct names in the list and after that find the frequency count of all these distinct names in the origninal list. We are interested in the maximum value of the frequency. You have to print this maximum frequency. If, the maximum value of the frequency occ...
24,697
Sonu and Monu are good friends. One day, Sonu gave a binary string of length L to Monu, and asks Monu to pick two positions a and b in the string. Now he given a number P to Monu and he have to tell what are the chances that there will be 1 on both positions and |a-b| ≤ P Note: Binary String means which contains only...
24,698
Koa the Koala has a binary string s of length n. Koa can perform no more than n-1 (possibly zero) operations of the following form: In one operation Koa selects positions i and i+1 for some i with 1 ≤ i < |s| and sets s_i to max(s_i, s_{i+1}). Then Koa deletes position i+1 from s (after the removal, the remaining part...
24,699