question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
On Bertown's main street n trees are growing, the tree number i has the height of ai meters (1 β€ i β€ n). By the arrival of the President of Berland these trees were decided to be changed so that their heights formed a beautiful sequence. This means that... |
Solve the programming task below in a Python markdown code block.
Do you know the story about the three musketeers? Anyway, you must help them now.
Richelimakieu is a cardinal in the city of Bearis. He found three brave warriors and called them the three musketeers. Athos has strength a, Borthos strength b, and Caram... |
Solve the programming task below in a Python markdown code block.
Kris works in a large company "Blake Technologies". As a best engineer of the company he was assigned a task to develop a printer that will be able to print horizontal and vertical strips. First prototype is already built and Kris wants to tests it. He ... |
Solve the programming task below in a Python markdown code block.
Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help.
Vasiliy is given n strings consisting of lowercase English letters. He wants them to be sorted in lexicographical order (as in the d... |
Solve the programming task below in a Python markdown code block.
There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each worker except the chief has exactly one immediate superior.
There was a request to each of the workers to tell how how many su... |
Solve the programming task below in a Python markdown code block.
a is an array of n positive integers, all of which are not greater than n.
You have to process q queries to this array. Each query is represented by two numbers p and k. Several operations are performed in each query; each operation changes p to p + ap... |
Solve the programming task below in a Python markdown code block.
There are n students who have taken part in an olympiad. Now it's time to award the students.
Some of them will receive diplomas, some wiil get certificates, and others won't receive anything. Students with diplomas and certificates are called winners.... |
Solve the programming task below in a Python markdown code block.
This is an interactive problem.
You are given a sorted in increasing order singly linked list. You should find the minimum integer in the list which is greater than or equal to x.
More formally, there is a singly liked list built on an array of n elem... |
Solve the programming task below in a Python markdown code block.
You are given a set of n points on the plane. A line containing the origin is called good, if projection of the given set to this line forms a symmetric multiset of points. Find the total number of good lines.
Multiset is a set where equal elements are... |
Solve the programming task below in a Python markdown code block.
Since Grisha behaved well last year, at New Year's Eve he was visited by Ded Moroz who brought an enormous bag of gifts with him! The bag contains n sweet candies from the good ol' bakery, each labeled from 1 to n corresponding to its tastiness. No two ... |
Solve the programming task below in a Python markdown code block.
Puchi and Ghissi are playing a game with strings. As Ghissi is a champion at strings, Puchi decides to challenge her. He gives Ghissi a string S and an integer K . The objective for Ghissi is to find a substring of S such that:
- The substring occ... |
Solve the programming task below in a Python markdown code block.
Pankaj is a very intelligent student studying in one of the best colleges of this country. He's good enough to challenge the smartest minds in the country, but even the smart ones make mistakes and so did Pankaj - he fell in love, ah. He was so deeply i... |
Solve the programming task below in a Python markdown code block.
Utkarsh's mother recently received N piles of books as a gift from someone. The i^th pile contains Bi books.
She neither wants to keep the voluminous books with herself nor she wants to throw them away. So, she decided to distribute them to students o... |
Solve the programming task below in a Python markdown code block.
Takahashi loves gold coins. He gains 1000 happiness points for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.)
Takahashi has X yen. If he exchanges his money so that he will gain the mos... |
Solve the programming task below in a Python markdown code block.
Chokudai made a rectangular cake for contestants in DDCC 2020 Finals.
The cake has H - 1 horizontal notches and W - 1 vertical notches, which divide the cake into H \times W equal sections. K of these sections has a strawberry on top of each of them.
... |
Solve the programming task below in a Python markdown code block.
Ken loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.
First, Ken stands on Vertex S. He wants to re... |
Solve the programming task below in a Python markdown code block.
Ringo is giving a present to Snuke.
Ringo has found out that Snuke loves yakiniku (a Japanese term meaning grilled meat. yaki: grilled, niku: meat). He supposes that Snuke likes grilled things starting with `YAKI` in Japanese, and does not like other t... |
Solve the programming task below in a Python markdown code block.
The problem set at CODE FESTIVAL 20XX Finals consists of N problems.
The score allocated to the i-th (1β¦iβ¦N) problem is i points.
Takahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve.
As probl... |
Solve the programming task below in a Python markdown code block.
Write a program which computes the area of a shape represented by the following three lines:
$y = x^2$
$y = 0$
$x = 600$
It is clear that the area is $72000000$, if you use an integral you learn in high school. On the other hand, we can obtain an ap... |
Solve the programming task below in a Python markdown code block.
The phantom thief "Lupin IV" is told by the beautiful "Fujiko Mine", a descendant of the Aizu clan, that the military funds left by the Aizu clan are sleeping in Aizuwakamatsu city. According to a report by Lupine's longtime companion, "Ishikawa Koshiem... |
Solve the programming task below in a Python markdown code block.
You are the planning manager of an animation production company. What animation production companies produce these days is not limited to animation itself. Related products, such as figures of characters and character song CDs, are also important source... |
Solve the programming task below in a Python markdown code block.
Description
THE BY DOLM @ STER is a training simulation game scheduled to be released on EXIDNA by 1rem on April 1, 2010. For the time being, it probably has nothing to do with an arcade game where the network connection service stopped earlier this mo... |
Solve the programming task below in a Python markdown code block.
H --Bit Operation Game
Given a rooted tree with N vertices. The vertices are numbered from 0 to N β 1, and the 0th vertex represents the root. `T = 0` for the root, but for the other vertices
* `T = T & X;`
* `T = T & Y;`
* `T = T | X`
* `T = T | Y`
*... |
Solve the programming task below in a Python markdown code block.
Problem
Mr. ukuku1333 is a little sloppy, so when I expanded the product of the linear expressions of x, I couldn't figure out the original linear expression.
Given the nth degree polynomial of x, factor it into the product of the original linear expre... |
Solve the programming task below in a Python markdown code block.
Depth-first search (DFS) follows the strategy to search βdeeperβ in the graph whenever possible. In DFS, edges are recursively explored out of the most recently discovered vertex $v$ that still has unexplored edges leaving it. When all of $v$'s edges ha... |
Solve the programming task below in a Python markdown code block.
Construct a dice from a given sequence of integers in the same way as Dice I.
You are given integers on the top face and the front face after the dice was rolled in the same way as Dice I. Write a program to print an integer on the right side face.
<... |
Solve the programming task below in a Python markdown code block.
You are given a positive integer n.
Let S(x) be sum of digits in base 10 representation of x, for example, S(123) = 1 + 2 + 3 = 6, S(0) = 0.
Your task is to find two integers a, b, such that 0 β€ a, b β€ n, a + b = n and S(a) + S(b) is the largest possi... |
Solve the programming task below in a Python markdown code block.
An accordion is a string (yes, in the real world accordions are musical instruments, but let's forget about it for a while) which can be represented as a concatenation of: an opening bracket (ASCII code 091), a colon (ASCII code 058), some (possibly zer... |
Solve the programming task below in a Python markdown code block.
When Petya went to school, he got interested in large numbers and what they were called in ancient times. For instance, he learned that the Russian word "tma" (which now means "too much to be counted") used to stand for a thousand and "tma tmyschaya" (w... |
Solve the programming task below in a Python markdown code block.
Bob is about to take a hot bath.
There are two taps to fill the bath: a hot water tap and a cold water tap. The cold water's temperature is t1, and the hot water's temperature is t2. The cold water tap can transmit any integer number of water units pe... |
Solve the programming task below in a Python markdown code block.
You are given two integers n and m (m < n). Consider a convex regular polygon of n vertices. Recall that a regular polygon is a polygon that is equiangular (all angles are equal in measure) and equilateral (all sides have the same length).
<image> Exam... |
Solve the programming task below in a Python markdown code block.
You are given a positive integer D. Let's build the following graph from it:
* each vertex is a divisor of D (not necessarily prime, 1 and D itself are also included);
* two vertices x and y (x > y) have an undirected edge between them if x is di... |
Solve the programming task below in a Python markdown code block.
This is an interactive problem. Don't forget to flush output after printing queries using cout.flush() or fflush(stdout) in C++ or similar functions in other programming languages.
There are n gift boxes in a row, numbered from 1 to n from left to righ... |
Solve the programming task below in a Python markdown code block.
Alice and Bob play a game. They have a binary string s (a string such that each character in it is either 0 or 1). Alice moves first, then Bob, then Alice again, and so on.
During their move, the player can choose any number (not less than one) of cons... |
Solve the programming task below in a Python markdown code block.
For some time the program of rounding numbers that had been developed by the Codeforces participants during one of the previous rounds, helped the citizens of Far Far Away to convert numbers into a more easily readable format. However, as time went by, ... |
Solve the programming task below in a Python markdown code block.
You are given an array a consisting of n integers. Initially all elements of a are either 0 or 1. You need to process q queries of two kinds:
* 1 x : Assign to a_x the value 1 - a_x.
* 2 k : Print the k-th largest value of the array.
As a remi... |
Solve the programming task below in a Python markdown code block.
You are given an array a of n (n β₯ 2) positive integers and an integer p. Consider an undirected weighted graph of n vertices numbered from 1 to n for which the edges between the vertices i and j (i<j) are added in the following manner:
* If gcd(a_i,... |
Solve the programming task below in a Python markdown code block.
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 the basic rules of writing spells.
Each spe... |
Solve the programming task below in a Python markdown code block.
You are given a weighted undirected graph. The vertices are enumerated from 1 to n. Your task is to find the shortest path between the vertex 1 and the vertex n.
Input
The first line contains two integers n and m (2 β€ n β€ 105, 0 β€ m β€ 105), where n is... |
Solve the programming task below in a Python markdown code block.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 1073741824 (230).
Input
The first line contains three space-separa... |
Solve the programming task below in a Python markdown code block.
Little Vasya had n boxes with balls in the room. The boxes stood in a row and were numbered with numbers from 1 to n from left to right.
Once Vasya chose one of the boxes, let's assume that its number is i, took all balls out from it (it is guaranteed ... |
Solve the programming task below in a Python markdown code block.
Bessie and the cows are playing with sequences and need your help. They start with a sequence, initially containing just the number 0, and perform n operations. Each operation is one of the following:
1. Add the integer xi to the first ai elements of... |
Solve the programming task below in a Python markdown code block.
Everybody knows that the Berland citizens are keen on health, especially students. Berland students are so tough that all they drink is orange juice!
Yesterday one student, Vasya and his mates made some barbecue and they drank this healthy drink only. ... |
Solve the programming task below in a Python markdown code block.
Vasya has recently found out what a digital root of a number is and he decided to share his knowledge with you.
Let's assume that S(n) is the sum of digits of number n, for example, S(4098) = 4 + 0 + 9 + 8 = 21. Then the digital root of number n equals... |
Solve the programming task below in a Python markdown code block.
The New Year is coming! That's why many people today are busy preparing New Year presents. Vasily the Programmer is no exception.
Vasily knows that the best present is (no, it's not a contest) money. He's put n empty wallets from left to right in a row... |
Solve the programming task below in a Python markdown code block.
School holidays come in Berland. The holidays are going to continue for n days. The students of school βN are having the time of their lives and the IT teacher Marina Sergeyevna, who has spent all the summer busy checking the BSE (Berland State Examinat... |
Solve the programming task below in a Python markdown code block.
A and B are preparing themselves for programming contests.
An important part of preparing for a competition is sharing programming knowledge from the experienced members to those who are just beginning to deal with the contests. Therefore, during the n... |
Solve the programming task below in a Python markdown code block.
Little girl Susie went shopping with her mom and she wondered how to improve service quality.
There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the tim... |
Solve the programming task below in a Python markdown code block.
You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any n... |
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.
Johnny drives a truck and must deliver a package from his hometown to the district center. His hometown is located at point 0 on a number line, and the district center is located at the point d.
Johnny's truck has a gas tank that holds exactly n liters... |
Solve the programming task below in a Python markdown code block.
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 abbrev... |
Solve the programming task below in a Python markdown code block.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number nΒ·m + 1 is a prime number".
Unfortunately, PolandBall is not ex... |
Solve the programming task below in a Python markdown code block.
You are given an array a consisting of n positive integers. You pick two integer numbers l and r from 1 to n, inclusive (numbers are picked randomly, equiprobably and independently). If l > r, then you swap values of l and r. You have to calculate the e... |
Solve the programming task below in a Python markdown code block.
Have you ever tried to explain to the coordinator, why it is eight hours to the contest and not a single problem has been prepared yet? Misha had. And this time he has a really strong excuse: he faced a space-time paradox! Space and time replaced each o... |
Solve the programming task below in a Python markdown code block.
You are given two positive integer numbers x and y. An array F is called an y-factorization of x iff the following conditions are met:
* There are y elements in F, and all of them are integer numbers;
* <image>.
You have to count the number of... |
Solve the programming task below in a Python markdown code block.
Let's denote a m-free matrix as a binary (that is, consisting of only 1's and 0's) matrix such that every square submatrix of size m Γ m of this matrix contains at least one zero.
Consider the following problem:
You are given two integers n and m. Yo... |
Solve the programming task below in a Python markdown code block.
A rectangle with sides A and B is cut into rectangles with cuts parallel to its sides. For example, if p horizontal and q vertical cuts were made, (p + 1) β
(q + 1) rectangles were left after the cutting. After the cutting, rectangles were of n differen... |
Solve the programming task below in a Python markdown code block.
You have to handle a very complex water distribution system. The system consists of n junctions and m pipes, i-th pipe connects junctions x_i and y_i.
The only thing you can do is adjusting the pipes. You have to choose m integer numbers f_1, f_2, ...,... |
Solve the programming task below in a Python markdown code block.
Chandu is a very strict mentor. He always gives a lot of work to his interns. So his interns decided to kill him. There is a party in the office on Saturday Night, and the interns decided to kill him on the same day. In the party, there are N beer bottl... |
Solve the programming task below in a Python markdown code block.
Today is the first class after a long vacation and as always Bagha woke up late. His friend, Nathumama has a motorcycle which they can use to reach class on time. However, Nathumama doesn't have enough fuel to reach class so Bagha makes a magic machine ... |
Solve the programming task below in a Python markdown code block.
Walter and Jesse's friend Mike had helped them in making Crymeth and hence, they wanted to give him a share.
For deciding the share, they both decided to choose one number each, X and Y and found out that K^th Highest Common Factor of their two numbers ... |
Solve the programming task below in a Python markdown code block.
Having learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together.
Given an integer N, determine whether N can be represented as the product of two integers between 1 and 9. If it can, print `Yes`; if it ... |
Solve the programming task below in a Python markdown code block.
You are given a string S of length 2N consisting of lowercase English letters.
There are 2^{2N} ways to color each character in S red or blue. Among these ways, how many satisfy the following condition?
* The string obtained by reading the characters ... |
Solve the programming task below in a Python markdown code block.
AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number.
Constraints
* 1 β€ a,b β€ 100
* a and b are integers.
Input
Input is given from Standard Input in the followin... |
Solve the programming task below in a Python markdown code block.
You've come to your favorite store Infinitesco to buy some ice tea.
The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen,... |
Solve the programming task below in a Python markdown code block.
You are given an integer N.
For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.
For example, F(3,11) = 2 since... |
Solve the programming task below in a Python markdown code block.
There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white.
Snuke plotted N p... |
Solve the programming task below in a Python markdown code block.
There is Kannon-do in the mountain behind Ichiro's house. There are 30 steps from the foot to this Kannon-do, and Ichiro goes to Kannon-do almost every day. Ichiro can go up the stairs up to 3 steps with one foot. While playing, I noticed that there are... |
Solve the programming task below in a Python markdown code block.
Aiz, which is located in cyberspace, trades information with Wakamatsu. The two countries are developing their economies by exchanging useful data with each other. The two countries, whose national policy is philanthropy and equality, and above all, the... |
Solve the programming task below in a Python markdown code block.
Taro decided to go to the summer festival held at JOI Shrine.
N night shops are open along the way to JOI Shrine. Each night shop is numbered from 1 to N in order, and the fun of playing and the time it takes to play are determined by integers. The fun... |
Solve the programming task below in a Python markdown code block.
Your mission in this problem is to write a computer program that manipulates molecular for- mulae in virtual chemistry. As in real chemistry, each molecular formula represents a molecule consisting of one or more atoms. However, it may not have chemical... |
Solve the programming task below in a Python markdown code block.
ICPC Calculator
In mathematics, we usually specify the order of operations by using parentheses. For example, 7 Γ (3 + 2) always means multiplying 7 by the result of 3 + 2 and never means adding 2 to the result of 7 Γ 3. However, there are people who d... |
Solve the programming task below in a Python markdown code block.
The full exploration sister is a very talented woman. Your sister can easily count the number of routes in a grid pattern if it is in the thousands. You and your exploration sister are now in a room lined with hexagonal tiles. The older sister seems to ... |
Solve the programming task below in a Python markdown code block.
JAG-channel
Nathan O. Davis operates an electronic bulletin board called JAG-channel. He is currently working on adding a new feature called Thread View.
Like many other electronic bulletin boards, JAG-channel is thread-based. Here, a thread refers to... |
Solve the programming task below in a Python markdown code block.
A-Aun's breathing
Problem Statement
Maeda-san and Goto-san, who will both turn 70 years old in 2060, are long-time friends and friends who fought together at the ACM-ICPC in college.
The two are still excited about competitive programming, drinking t... |
Solve the programming task below in a Python markdown code block.
problem
AOR Ika made a set $ S = \\ {a_1, ..., a_N \\} $ and a map $ f: S β S $. $ f (a_i) = b_i $. For any element $ x $ in the set $ S $, all maps $ g, h: S β S $ satisfying $ g (f (x)) = h (f (x)) $ are $ g (x). ) = Determine if h (x) $ is satisfied... |
Solve the programming task below in a Python markdown code block.
The chef is preparing a birthday cake for one of his guests,
and his decided to write the age of the guest in candles on the cake.
There are 10 types of candles, one for each of the digits '0' through '9'.
The chef has forgotten the age of the guest, ho... |
Solve the programming task below in a Python markdown code block.
Chef has learned a new technique for comparing two recipes. A recipe contains a list of ingredients in increasing order of the times they will be processed. An ingredient is represented by a letter 'a'-'z'. The i-th letter in a recipe denotes the i-th i... |
Solve the programming task below in a Python markdown code block.
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a posit... |
Solve the programming task below in a Python markdown code block.
The Metropolis computer network consists of n servers, each has an encryption key in the range from 0 to 2^k - 1 assigned to it. Let c_i be the encryption key assigned to the i-th server. Additionally, m pairs of servers are directly connected via a dat... |
Solve the programming task below in a Python markdown code block.
You are given a matrix a, consisting of n rows and m columns. Each cell contains an integer in it.
You can change the order of rows arbitrarily (including leaving the initial order), but you can't change the order of cells in a row. After you pick some... |
Solve the programming task below in a Python markdown code block.
Student Dima from Kremland has a matrix a of size n Γ m filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help ... |
Solve the programming task below in a Python markdown code block.
Nauuo is a girl who loves writing comments.
One day, she posted a comment on Codeforces, wondering whether she would get upvotes or downvotes.
It's known that there were x persons who would upvote, y persons who would downvote, and there were also ano... |
Solve the programming task below in a Python markdown code block.
There are n points on the plane, the i-th of which is at (x_i, y_i). Tokitsukaze wants to draw a strange rectangular area and pick all the points in the area.
The strange area is enclosed by three lines, x = l, y = a and x = r, as its left side, its bo... |
Solve the programming task below in a Python markdown code block.
This is an easier version of the next problem. In this version, q = 0.
A sequence of integers is called nice if its elements are arranged in blocks like in [3, 3, 3, 4, 1, 1]. Formally, if two elements are equal, everything in between must also be equa... |
Solve the programming task below in a Python markdown code block.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya calls a number almost lucky... |
Solve the programming task below in a Python markdown code block.
You are given n integers a_1, a_2, ..., a_n, such that for each 1β€ i β€ n holds i-nβ€ a_iβ€ i-1.
Find some nonempty subset of these integers, whose sum is equal to 0. It can be shown that such a subset exists under given constraints. If there are several ... |
Solve the programming task below in a Python markdown code block.
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself.
<image>
Recently Xenia has bought n_r red gems, n_g green gems and n_b blue gems. Each of the gems has a weight.
N... |
Solve the programming task below in a Python markdown code block.
Levian works as an accountant in a large company. Levian knows how much the company has earned in each of the n consecutive months β in the i-th month the company had income equal to a_i (positive income means profit, negative income means loss, zero in... |
Solve the programming task below in a Python markdown code block.
Acacius is studying strings theory. Today he came with the following problem.
You are given a string s of length n consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in su... |
Solve the programming task below in a Python markdown code block.
Easy and hard versions are actually different problems, so we advise you to read both statements carefully.
You are given a weighted rooted tree, vertex 1 is the root of this tree. Also, each edge has its own cost.
A tree is a connected graph without ... |
Solve the programming task below in a Python markdown code block.
Consider a long corridor which can be divided into n square cells of size 1 Γ 1. These cells are numbered from 1 to n from left to right.
There are two people in this corridor, a hooligan and a security guard. Initially, the hooligan is in the a-th cel... |
Solve the programming task below in a Python markdown code block.
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: s of length n and t of length m.
A sequence p_1, p_2, β¦, p_m, where 1 β€ p_1 < p_2 < β¦ < p_m β€ n, is called beautiful, if s_{p_i} = t_i f... |
Solve the programming task below in a Python markdown code block.
To satisfy his love of matching socks, Phoenix has brought his n socks (n is even) to the sock store. Each of his socks has a color c_i and is either a left sock or right sock.
Phoenix can pay one dollar to the sock store to either:
* recolor a so... |
Solve the programming task below in a Python markdown code block.
Let f(i) denote the minimum positive integer x such that x is not a divisor of i.
Compute β_{i=1}^n f(i) modulo 10^9+7. In other words, compute f(1)+f(2)+...+f(n) modulo 10^9+7.
Input
The first line contains a single integer t (1β€ tβ€ 10^4), the numbe... |
Solve the programming task below in a Python markdown code block.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a Γ b centimeters. Because of some production peculiarities a screen parameters are integer numbers. Recently the screen sides ratio x: y became popular with use... |
Solve the programming task below in a Python markdown code block.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?
You are given a syste... |
Solve the programming task below in a Python markdown code block.
Maxim has opened his own restaurant! The restaurant has got a huge table, the table's length is p meters.
Maxim has got a dinner party tonight, n guests will come to him. Let's index the guests of Maxim's restaurant from 1 to n. Maxim knows the sizes o... |
Solve the programming task below in a Python markdown code block.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three distinct integer horizontal straight lines, except for the av... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.