task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Title: Cipher Time Limit: None seconds Memory Limit: None megabytes Problem Description: Borya has recently found a big electronic display. The computer that manages the display stores some integer number. The number has *n* decimal digits, the display shows the encoded version of the number, where each digit is sho...
2,900
Title: Circle of Numbers Time Limit: None seconds Memory Limit: None megabytes Problem Description: *n* evenly spaced points have been marked around the edge of a circle. There is a number written at each point. You choose a positive real number *k*. Then you may repeatedly select a set of 2 or more points which are...
2,901
Title: Little Elephant and Bits Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Little Elephant has an integer *a*, written in the binary notation. He wants to write this number on a piece of paper. To make sure that the number *a* fits on the piece of paper, the Little Elephant ought...
2,902
Title: Levko and Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: Levko loves sports pathfinding competitions in his city very much. In order to boost his performance, Levko spends his spare time practicing. The practice is a game. The city consists of *n* intersections connected by *...
2,903
Title: Help Vasilisa the Wise 2 Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know wha...
2,904
Title: Partial Sums Time Limit: None seconds Memory Limit: None megabytes Problem Description: You've got an array *a*, consisting of *n* integers. The array elements are indexed from 1 to *n*. Let's determine a two step operation like that: 1. First we build by the array *a* an array *s* of partial sums, consisti...
2,905
Title: Escape Time Limit: None seconds Memory Limit: None megabytes Problem Description: The princess is going to escape the dragon's cave, and she needs to plan it carefully. The princess runs at *v**p* miles per hour, and the dragon flies at *v**d* miles per hour. The dragon will discover the escape after *t* hou...
2,906
Title: Optimal Number Permutation Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have array *a* that contains all integers from 1 to *n* twice. You can arbitrary permute any numbers in *a*. Let number *i* be in positions *x**i*,<=*y**i* (*x**i*<=&lt;<=*y**i*) in the permuted array *a...
2,907
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have a garden consisting entirely of grass and weeds. Your garden is described by an *n*<=×<=*m* grid, with rows numbered 1 to *n* from top to bottom, and columns 1 to *m* from left to right. Each cell is identified by a pair ...
2,908
Title: Serega and Fun Time Limit: None seconds Memory Limit: None megabytes Problem Description: Serega loves fun. However, everyone has fun in the unique manner. Serega has fun by solving query problems. One day Fedor came up with such a problem. You are given an array *a* consisting of *n* positive integers and q...
2,909
Title: ucyhf Time Limit: None seconds Memory Limit: None megabytes Problem Description: qd ucyhf yi q fhycu dkcruh mxeiu huluhiu yi q tyvvuhudj fhycu dkcruh. oekh jqia yi je vydt jxu djx ucyhf. Input Specification: jxu ydfkj sediyiji ev q iydwbu ydjuwuh *d* (1<=≤<=*d*<=≤<=11184) — jxu edu-rqiut ydtun ev jxu ucyhf j...
2,910
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: During the last Sereja's Codesecrof round the server crashed many times, so the round was decided to be made unrated for some participants. Let's assume that *n* people took part in the contest. Let's assume that the participant...
2,911
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Kevin and Nicky Sun have invented a new game called Lieges of Legendre. In this game, two players take turns modifying the game state with Kevin moving first. Initially, the game is set up so that there are *n* piles of cows, with...
2,912
Title: Case of Fake Numbers Time Limit: None seconds Memory Limit: None megabytes Problem Description: Andrewid the Android is a galaxy-famous detective. He is now investigating a case of frauds who make fake copies of the famous Stolp's gears, puzzles that are as famous as the Rubik's cube once was. Its most impor...
2,913
Title: The Holmes Children Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Holmes children are fighting over who amongst them is the cleverest. Mycroft asked Sherlock and Eurus to find value of *f*(*n*), where *f*(1)<==<=1 and for *n*<=≥<=2, *f*(*n*) is the number of distinct ordered ...
2,914
Title: Boring Partition Time Limit: None seconds Memory Limit: None megabytes Problem Description: This problem is the most boring one you've ever seen. Given a sequence of integers *a*1,<=*a*2,<=...,<=*a**n* and a non-negative integer *h*, our goal is to partition the sequence into two subsequences (not necessari...
2,915
Title: Vasya and Wrestling Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins. When the numbers of points of both wrestlers ...
2,916
Title: Dreamoon and WiFi Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands through Wi-Fi to Dreamoon's smartphone and Dreamoon follows them. Each command is one of the following two types: 1. Go...
2,917
Title: Building Permutation Time Limit: None seconds Memory Limit: None megabytes Problem Description: Permutation *p* is an ordered set of integers *p*1,<=<=*p*2,<=<=...,<=<=*p**n*, consisting of *n* distinct positive integers, each of them doesn't exceed *n*. We'll denote the *i*-th element of permutation *p* as *...
2,918
Title: Inbox (100500) Time Limit: None seconds Memory Limit: None megabytes Problem Description: Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content of a single letter. As soo...
2,919
Title: Resource Distribution Time Limit: None seconds Memory Limit: None megabytes Problem Description: One department of some software company has $n$ servers of different specifications. Servers are indexed with consecutive integers from $1$ to $n$. Suppose that the specifications of the $j$-th server may be expre...
2,920
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store recently and Artem immediately bough...
2,921
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: 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...
2,922
Title: Magic Matrix Time Limit: None seconds Memory Limit: None megabytes Problem Description: You're given a matrix *A* of size *n*<=×<=*n*. Let's call the matrix with nonnegative elements magic if it is symmetric (so *a**ij*<==<=*a**ji*), *a**ii*<==<=0 and *a**ij*<=≤<=*max*(*a**ik*,<=*a**jk*) for all triples *i*,...
2,923
Title: Running Track Time Limit: None seconds Memory Limit: None megabytes Problem Description: A boy named Ayrat lives on planet AMI-1511. Each inhabitant of this planet has a talent. Specifically, Ayrat loves running, moreover, just running is not enough for him. He is dreaming of making running a real art. First...
2,924
Title: Lucky Permutation Triple Time Limit: None seconds Memory Limit: None megabytes Problem Description: Bike is interested in permutations. A permutation of length *n* is an integer sequence such that each integer from 0 to (*n*<=-<=1) appears exactly once in it. For example, [0,<=2,<=1] is a permutation of lengt...
2,925
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Furik and Rubik love playing computer games. Furik has recently found a new game that greatly interested Rubik. The game consists of *n* parts and to complete each part a player may probably need to complete some other ones. We kn...
2,926
Title: George and Number Time Limit: None seconds Memory Limit: None megabytes Problem Description: George is a cat, so he really likes to play. Most of all he likes to play with his array of positive integers *b*. During the game, George modifies the array by using special changes. Let's mark George's current array...
2,927
Title: OR in Matrix Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let's define logical *OR* as an operation on two logical values (i. e. values that belong to the set {0,<=1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical...
2,928
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day, little Vasya found himself in a maze consisting of (*n*<=+<=1) rooms, numbered from 1 to (*n*<=+<=1). Initially, Vasya is at the first room and to get out of the maze, he needs to get to the (*n*<=+<=1)-th one. The maze ...
2,929
Title: pSort Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: One day *n* cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's favourite number. On it's move *i*-th c...
2,930
Title: Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: Allen and Bessie are playing a simple number game. They both know a function $f: \{0, 1\}^n \to \mathbb{R}$, i. e. the function takes $n$ binary arguments and returns a real value. At the start of the game, the variables $x_1, x_2...
2,931
Title: none Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: The year of 2012 is coming... According to an ancient choradrican legend in this very year, in 2012, Diablo and his brothers Mephisto and Baal will escape from hell, and innumerable hordes of demons will enslave the human world. But ...
2,932
Title: Arpa and a game with Mojtaba Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mojtaba and Arpa are playing a game. They have a list of *n* numbers in the game. In a player's turn, he chooses a number *p**k* (where *p* is a prime number and *k* is a positive integer) such that *p**k*...
2,933
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name *w* and the collection of forbi...
2,934
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Родители Васи хотят, чтобы он как можно лучше учился. Поэтому если он получает подряд три положительные оценки («четвёрки» или «пятёрки»), они дарят ему подарок. Соответственно, оценки «единица», «двойка» и «тройка» родители Васи ...
2,935
Title: Road to Cinema Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in *t* minutes. There is a straight road of length *s* from the service to the cinema. Let's introduce ...
2,936
Title: The table Time Limit: None seconds Memory Limit: None megabytes Problem Description: Harry Potter has a difficult homework. Given a rectangular table, consisting of *n*<=×<=*m* cells. Each cell of the table contains the integer. Harry knows how to use two spells: the first spell change the sign of the integer...
2,937
Title: Calculating Function Time Limit: None seconds Memory Limit: None megabytes Problem Description: For a positive integer *n* let's define a function *f*: *f*(*n*)<==<=<=-<=1<=+<=2<=-<=3<=+<=..<=+<=(<=-<=1)*n**n* Your task is to calculate *f*(*n*) for a given integer *n*. Input Specification: The single line...
2,938
Title: Ancient Prophesy Time Limit: None seconds Memory Limit: None megabytes Problem Description: A recently found Ancient Prophesy is believed to contain the exact Apocalypse date. The prophesy is a string that only consists of digits and characters "-". We'll say that some date is mentioned in the Prophesy if th...
2,939
Title: Points Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Pete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as follows: point (0,<=0) is located in the bottom-left corner, *Ox* axis is directed right, *Oy* axis is direc...
2,940
Title: Dividing Island Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: A revolution took place on the Buka Island. New government replaced the old one. The new government includes *n* parties and each of them is entitled to some part of the island according to their contribution to the revolut...
2,941
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: A *k*-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by *k*. That is, there are no two integers *x* and *y* (*x*<=&lt;<=*y*) from the set, such that *y*<=...
2,942
Title: Love Triangles Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are many anime that are about "love triangles": Alice loves Bob, and Charlie loves Bob as well, but Alice hates Charlie. You are thinking about an anime which has *n* characters. The characters are labeled from 1 t...
2,943
Title: Event Dates Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: On a history lesson the teacher asked Vasya to name the dates when *n* famous events took place. He doesn't remembers the exact dates but he remembers a segment of days [*l**i*,<=*r**i*] (inclusive) on which the event could hav...
2,944
Title: Heroes Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: The year of 2012 is coming... According to an ancient choradrican legend in this very year, in 2012, Diablo and his brothers Mephisto and Baal will escape from hell, and innumerable hordes of demons will enslave the human world. Bu...
2,945
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: On vacations *n* pupils decided to go on excursion and gather all together. They need to overcome the path with the length *l* meters. Each of the pupils will go with the speed equal to *v*1. To get to the excursion quickly, it wa...
2,946
Title: Museum Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: One day as Petya and his friend Vasya were having one of their numerous trips, they decided to visit a museum castle. The museum has a specific shape: it consists of *n* rooms connected with *m* corridors so that one can access any ...
2,947
Title: Fox and Perfect Sets Time Limit: None seconds Memory Limit: None megabytes Problem Description: 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* can be equal to *b*), . Where operation *xor* means exclusive or operation (htt...
2,948
Title: none Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: For some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all. Anvils come in different sizes and shapes. ...
2,949
Title: Very Beautiful Number Time Limit: None seconds Memory Limit: None megabytes Problem Description: Teacher thinks that we make a lot of progress. Now we are even allowed to use decimal notation instead of counting sticks. After the test the teacher promised to show us a "very beautiful number". But the problem ...
2,950
Title: Valera and Elections Time Limit: None seconds Memory Limit: None megabytes Problem Description: The city Valera lives in is going to hold elections to the city Parliament. The city has *n* districts and *n*<=-<=1 bidirectional roads. We know that from any district there is a path along the roads to any other...
2,951
Title: Travelling Through the Snow Queen's Kingdom Time Limit: None seconds Memory Limit: None megabytes Problem Description: Gerda is travelling to the palace of the Snow Queen. The road network consists of *n* intersections and *m* bidirectional roads. Roads are numbered from 1 to *m*. Snow Queen put a powerful s...
2,952
Title: Sonya and Matrix Time Limit: None seconds Memory Limit: None megabytes Problem Description: Since Sonya has just learned the basics of matrices, she decided to play with them a little bit. Sonya imagined a new type of matrices that she called rhombic matrices. These matrices have exactly one zero, while all ...
2,953
Title: Joty and Chocolate Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Joty has got a task to do. She has a line of *n* tiles indexed from 1 to *n*. She has to paint them in a strange pattern. An unpainted tile should be painted Red if it's index is divisible by *a* and an unpai...
2,954
Title: Jzzhu and Numbers Time Limit: None seconds Memory Limit: None megabytes Problem Description: Jzzhu have *n* non-negative integers *a*1,<=*a*2,<=...,<=*a**n*. We will call a sequence of indexes *i*1,<=*i*2,<=...,<=*i**k* (1<=≤<=*i*1<=&lt;<=*i*2<=&lt;<=...<=&lt;<=*i**k*<=≤<=*n*) a group of size *k*. Jzzhu won...
2,955
Title: Bottles Time Limit: None seconds Memory Limit: None megabytes Problem Description: Nick has *n* bottles of soda left after his birthday. Each bottle is described by two values: remaining amount of soda *a**i* and bottle volume *b**i* (*a**i*<=≤<=*b**i*). Nick has decided to pour all remaining soda into minim...
2,956
Title: Towers Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Little Vasya has received a young builder’s kit. The kit consists of several wooden bars, the lengths of all of them are known. The bars can be put one on the top of the other if their lengths are the same. Vasya wants to construct...
2,957
Title: Less or Equal Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a sequence of integers of length $n$ and integer number $k$. You should print any integer number $x$ in the range of $[1; 10^9]$ (i.e. $1 \le x \le 10^9$) such that exactly $k$ elements of given sequence are...
2,958
Title: Ratings and Reality Shows Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are two main kinds of events in the life of top-model: fashion shows and photo shoots. Participating in any of these events affects the rating of appropriate top-model. After each photo shoot model's rat...
2,959
Title: Frames Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day Vasya got hold of a sheet of checkered paper *n*<=×<=*m* squares in size. Our Vasya adores geometrical figures, so he painted two rectangles on the paper. The rectangles' sides are parallel to the coordinates' axes, also...
2,960
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mister B has a house in the middle of a giant plain field, which attracted aliens life. For convenience, aliens specified the Cartesian coordinate system on the field in such a way that Mister B's house has coordinates (0,<=0). Af...
2,961
Title: XOR and Favorite Number Time Limit: None seconds Memory Limit: None megabytes Problem Description: Bob has a favorite number *k* and *a**i* of length *n*. Now he asks you to answer *m* queries. Each query is given by a pair *l**i* and *r**i* and asks you to count the number of pairs of integers *i* and *j*, s...
2,962
Title: Keyboard Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has *n* rows of keys containing *m* keys in each row. Besides, the keys are of two types. Some of the keys have lowercase Latin letters on ...
2,963
Title: Palindrome Time Limit: None seconds Memory Limit: None megabytes Problem Description: Given a string *s*, determine if it contains any palindrome of length exactly 100 as a subsequence. If it has any, print any one of them. If it doesn't have any, print a palindrome that is a subsequence of *s* and is as long...
2,964
Title: Borya and Hanabi Time Limit: None seconds Memory Limit: None megabytes Problem Description: Have you ever played Hanabi? If not, then you've got to try it out! This problem deals with a simplified version of the game. Overall, the game has 25 types of cards (5 distinct colors and 5 distinct values). Borya is...
2,965
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value *n* times, and then compute the average value to lower the error. Kirill has already made his measurements, and has got the ...
2,966
Title: Warehouse Time Limit: 2 seconds Memory Limit: 64 megabytes Problem Description: Once upon a time, when the world was more beautiful, the sun shone brighter, the grass was greener and the sausages tasted better Arlandia was the most powerful country. And its capital was the place where our hero DravDe worked. ...
2,967
Title: Laptops Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the...
2,968
Title: Circle Line Time Limit: None seconds Memory Limit: None megabytes Problem Description: 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...
2,969
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness". The test consists of *n* questions; the que...
2,970
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Поликарп мечтает стать программистом и фанатеет от степеней двойки. Среди двух чисел ему больше нравится то, которое делится на большую степень числа 2. По заданной последовательности целых положительных чисел *a*1,<=*a*2,<=...,...
2,971
Title: Restore the Tree Time Limit: None seconds Memory Limit: None megabytes Problem Description: Petya had a tree consisting of *n* vertices numbered with integers from 1 to *n*. Accidentally he lost his tree. Petya remembers information about *k* vertices: distances from each of them to each of the *n* tree ver...
2,972
Title: Gripping Story Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day Qwerty the Ranger witnessed two transport ships collide with each other. As a result, all contents of their cargo holds scattered around the space. And now Qwerty wants to pick as many lost items as possible to s...
2,973
Title: A Determined Cleanup Time Limit: None seconds Memory Limit: None megabytes Problem Description: In order to put away old things and welcome a fresh new year, a thorough cleaning of the house is a must. Little Tommy finds an old polynomial and cleaned it up by taking it modulo another. But now he regrets doin...
2,974
Title: Mahmoud and Ehab and the function Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dr. Evil is interested in math and functions, so he gave Mahmoud and Ehab array *a* of length *n* and array *b* of length *m*. He introduced a function *f*(*j*) which is defined for integers *j*, which...
2,975
Title: Quarrel Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: Friends Alex and Bob live in Bertown. In this town there are *n* crossroads, some of them are connected by bidirectional roads of equal length. Bob lives in a house at the crossroads number 1, Alex — in a house at the crossroads nu...
2,976
Title: Devu and Flowers Time Limit: None seconds Memory Limit: None megabytes Problem Description: Devu wants to decorate his garden with flowers. He has purchased *n* boxes, where the *i*-th box contains *f**i* flowers. All flowers in a single box are of the same color (hence they are indistinguishable). Also, no t...
2,977
Title: Array Covering Time Limit: None seconds Memory Limit: None megabytes Problem Description: Misha has an array of integers of length *n*. He wants to choose *k* different continuous subarrays, so that each element of the array belongs to at least one of the chosen subarrays. Misha wants to choose the subarrays...
2,978
Title: Candy Shop Time Limit: None seconds Memory Limit: None megabytes Problem Description: The prestigious Codeforces kindergarten consists of *n* kids, numbered 1 through *n*. Each of them are given allowance in rubles by their parents. Today, they are going to the most famous candy shop in the town. The shop se...
2,979
Title: Mashmokh and Reverse Operation Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh's team. In o...
2,980
Title: Mike and Fax Time Limit: None seconds Memory Limit: None megabytes Problem Description: While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string *s*. He is not sure ...
2,981
Title: Om Nom and Spiders Time Limit: None seconds Memory Limit: None megabytes Problem Description: Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. Th...
2,982
Title: Wizards and Minimal Spell Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let's dive into one of the most interesting areas of magic — writing spells. Learning this exciting but challenging science is very troublesome, so now you will not learn the magic words, but only get to know ...
2,983
Title: Hungry Sequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: Iahub and Iahubina went to a date at a luxury restaurant. Everything went fine until paying for the food. Instead of money, the waiter wants Iahub to write a Hungry sequence consisting of *n* integers. A sequence *a*1...
2,984
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ivan had string *s* consisting of small English letters. However, his friend Julia decided to make fun of him and hid the string *s*. Ivan preferred making a new string to finding the old one. Ivan knows some information about t...
2,985
Title: Seller Bob Time Limit: 2 seconds Memory Limit: 128 megabytes Problem Description: Last year Bob earned by selling memory sticks. During each of *n* days of his work one of the two following events took place: - A customer came to Bob and asked to sell him a 2*x* MB memory stick. If Bob had such a stick, he...
2,986
Title: Chores Time Limit: None seconds Memory Limit: None megabytes Problem Description: Luba has to do *n* chores today. *i*-th chore takes *a**i* units of time to complete. It is guaranteed that for every the condition *a**i*<=≥<=*a**i*<=-<=1 is met, so the sequence is sorted. Also Luba can work really hard on s...
2,987
Title: Anton and Letters Time Limit: None seconds Memory Limit: None megabytes Problem Description: Recently, Anton has found a set. The set consists of small English letters. Anton carefully wrote out all the letters from the set in one line, separated by a comma. He also added an opening curved bracket at the begi...
2,988
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sasha is taking part in a programming competition. In one of the problems she should check if some rooted trees are isomorphic or not. She has never seen this problem before, but, being an experienced participant, she guessed that...
2,989
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an *h*<=×<=*w* field, and it is painted in two colors, but not like in chess. Almost all cells of ...
2,990
Title: Text Editor Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya is pressing the keys on the keyboard reluctantly, squeezing out his ideas on the classical epos depicted in Homer's Odysseus... How can he explain to his literature teacher that he isn't going to become a writer? In f...
2,991
Title: Pave the Parallelepiped Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a rectangular parallelepiped with sides of positive integer lengths $A$, $B$ and $C$. Find the number of different groups of three integers ($a$, $b$, $c$) such that $1\leq a\leq b\leq c$ and par...
2,992
Title: Dominant Indices Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a rooted undirected tree consisting of $n$ vertices. Vertex $1$ is the root. Let's denote a depth array of vertex $x$ as an infinite sequence $[d_{x, 0}, d_{x, 1}, d_{x, 2}, \dots]$, where $d_{x, i}$ is ...
2,993
Title: Cd and pwd commands Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the cu...
2,994
Title: Mutation Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: Scientists of planet Olympia are conducting an experiment in mutation of primitive organisms. Genome of organism from this planet can be represented as a string of the first *K* capital English letters. For each pair of types of g...
2,995
Title: Almost Arithmetic Progression Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarp likes arithmetic progressions. A sequence $[a_1, a_2, \dots, a_n]$ is called an arithmetic progression if for each $i$ ($1 \le i &lt; n$) the value $a_{i+1} - a_i$ is the same. For example, the se...
2,996
Title: Фото на память - 2 (round version) Time Limit: None seconds Memory Limit: None megabytes Problem Description: Прошло много лет, и на вечеринке снова встретились *n* друзей. С момента последней встречи техника шагнула далеко вперёд, появились фотоаппараты с автоспуском, и теперь не требуется, чтобы один из дру...
2,997
Title: Urbanization Time Limit: None seconds Memory Limit: None megabytes Problem Description: Local authorities have heard a lot about combinatorial abilities of Ostap Bender so they decided to ask his help in the question of urbanization. There are *n* people who plan to move to the cities. The wealth of the *i* o...
2,998
Title: Wasted Time Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mr. Scrooge, a very busy man, decided to count the time he wastes on all sorts of useless stuff to evaluate the lost profit. He has already counted the time he wastes sleeping and eating. And now Mr. Scrooge wants to count ...
2,999