Little C loves number «3» very much. He loves all things about it.
Now he has a positive integer $$$n$$$. He wants to split $$$n$$$ into $$$3$$$ positive integers $$$a,b,c$$$, such that $$$a+b+c=n$$$ and none of the $$$3$$$ integers is a multiple of $$$3$$$. Help him to find a solution.
A single line containing one integer $$$n$$$ ($$$3 \leq n \leq 10^9$$$) — the integer Little C has.
Print $$$3$$$ positive integers $$$a,b,c$$$ in a single line, such that $$$a+b+c=n$$$ and none of them is a multiple of $$$3$$$.
It can be proved that there is at least one solution. If there are multiple solutions, print any of them.
3
1 1 1
233
77 77 79
There are $$$n$$$ points on the plane, $$$(x_1,y_1), (x_2,y_2), \ldots, (x_n,y_n)$$$.
You need to place an isosceles triangle with two sides on the coordinate axis to cover all points (a point is covered if it lies inside the triangle or on the side of the triangle). Calculate the minimum length of the shorter side of the triangle.
First line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$).
Each of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \leq x_i,y_i \leq 10^9$$$).
Print the minimum length of the shorter side of the triangle. It can be proved that it's always an integer.
3
1 1
1 2
2 1
3
4
1 1
1 2
2 1
2 2
4
Illustration for the first example: 
Illustration for the second example: 
Mr. F has $$$n$$$ positive integers, $$$a_1, a_2, \ldots, a_n$$$.
He thinks the greatest common divisor of these integers is too small. So he wants to enlarge it by removing some of the integers.
But this problem is too simple for him, so he does not want to do it by himself. If you help him, he will give you some scores in reward.
Your task is to calculate the minimum number of integers you need to remove so that the greatest common divisor of the remaining integers is bigger than that of all integers.
The first line contains an integer $$$n$$$ ($$$2 \leq n \leq 3 \cdot 10^5$$$) — the number of integers Mr. F has.
The second line contains $$$n$$$ integers, $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 1.5 \cdot 10^7$$$).
Print an integer — the minimum number of integers you need to remove so that the greatest common divisor of the remaining integers is bigger than that of all integers.
You should not remove all of the integers.
If there is no solution, print «-1» (without quotes).
3
1 2 4
1
4
6 9 15 30
2
3
1 1 1
-1
In the first example, the greatest common divisor is $$$1$$$ in the beginning. You can remove $$$1$$$ so that the greatest common divisor is enlarged to $$$2$$$. The answer is $$$1$$$.
In the second example, the greatest common divisor is $$$3$$$ in the beginning. You can remove $$$6$$$ and $$$9$$$ so that the greatest common divisor is enlarged to $$$15$$$. There is no solution which removes only one integer. So the answer is $$$2$$$.
In the third example, there is no solution to enlarge the greatest common divisor. So the answer is $$$-1$$$.
Little C loves number «3» very much. He loves all things about it.
Now he is playing a game on a chessboard of size $$$n \times m$$$. The cell in the $$$x$$$-th row and in the $$$y$$$-th column is called $$$(x,y)$$$. Initially, The chessboard is empty. Each time, he places two chessmen on two different empty cells, the Manhattan distance between which is exactly $$$3$$$. The Manhattan distance between two cells $$$(x_i,y_i)$$$ and $$$(x_j,y_j)$$$ is defined as $$$|x_i-x_j|+|y_i-y_j|$$$.
He want to place as many chessmen as possible on the chessboard. Please help him find the maximum number of chessmen he can place.
A single line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n,m \leq 10^9$$$) — the number of rows and the number of columns of the chessboard.
Print one integer — the maximum number of chessmen Little C can place.
2 2
0
3 3
8
In the first example, the Manhattan distance between any two cells is smaller than $$$3$$$, so the answer is $$$0$$$.
In the second example, a possible solution is $$$(1,1)(3,2)$$$, $$$(1,2)(3,3)$$$, $$$(2,1)(1,3)$$$, $$$(3,1)(2,3)$$$.
There are $$$n$$$ cities in the Kingdom of Autumn, numbered from $$$1$$$ to $$$n$$$. People can travel between any two cities using $$$n-1$$$ two-directional roads.
This year, the government decides to separate the kingdom. There will be regions of different levels. The whole kingdom will be the region of level $$$1$$$. Each region of $$$i$$$-th level should be separated into several (at least two) regions of $$$i+1$$$-th level, unless $$$i$$$-th level is the last level. Each city should belong to exactly one region of each level and for any two cities in the same region, it should be possible to travel between them passing the cities in the same region only.
According to research, for each city $$$i$$$, there is a value $$$a_i$$$, which describes the importance of this city. All regions of the same level should have an equal sum of city importances.
Your task is to find how many plans there are to determine the separation of the regions that all the conditions are satisfied. Two plans are considered different if and only if their numbers of levels are different or there exist two cities in the same region of one level in one plan but in different regions of this level in the other plan. Since the answer may be very large, output it modulo $$$10^9+7$$$.
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^6$$$) — the number of the cities.
The second line contains $$$n$$$ integers, the $$$i$$$-th of which is $$$a_i$$$ ($$$1 \leq a_i \leq 10^9$$$) — the value of each city.
The third line contains $$$n-1$$$ integers, $$$p_1, p_2, \ldots, p_{n-1}$$$; $$$p_i$$$ ($$$p_i \leq i$$$) describes a road between cities $$$p_i$$$ and $$$i+1$$$.
Print one integer — the number of different plans modulo $$$10^9+7$$$.
4
1 1 1 1
1 2 3
4
4
1 1 1 1
1 2 2
2
4
1 2 1 2
1 1 3
3
For the first example, there are $$$4$$$ different plans:
Plan $$$1$$$: Level-$$$1$$$: $$$\{1,2,3,4\}$$$.
Plan $$$2$$$: Level-$$$1$$$: $$$\{1,2,3,4\}$$$, Level-$$$2$$$: $$$\{1,2\}$$$,$$$\{3,4\}$$$.
Plan $$$3$$$: Level-$$$1$$$: $$$\{1,2,3,4\}$$$, Level-$$$2$$$: $$$\{1\}$$$,$$$\{2\}$$$,$$$\{3\}$$$,$$$\{4\}$$$.
Plan $$$4$$$: Level-$$$1$$$: $$$\{1,2,3,4\}$$$, Level-$$$2$$$: $$$\{1,2\}$$$,$$$\{3,4\}$$$, Level-$$$3$$$: $$$\{1\}$$$,$$$\{2\}$$$,$$$\{3\}$$$,$$$\{4\}$$$.
For the second example, there are $$$2$$$ different plans:
Plan $$$1$$$: Level-$$$1$$$: $$$\{1,2,3,4\}$$$.
Plan $$$2$$$: Level-$$$1$$$: $$$\{1,2,3,4\}$$$, Level-$$$2$$$: $$$\{1\}$$$,$$$\{2\}$$$,$$$\{3\}$$$,$$$\{4\}$$$.
For the third example, there are $$$3$$$ different plans:
Plan $$$1$$$: Level-$$$1$$$: $$$\{1,2,3,4\}$$$.
Plan $$$2$$$: Level-$$$1$$$: $$$\{1,2,3,4\}$$$, Level-$$$2$$$: $$$\{1,2\}$$$,$$$\{3,4\}$$$.
Plan $$$3$$$: Level-$$$1$$$: $$$\{1,2,3,4\}$$$, Level-$$$2$$$: $$$\{1,3\}$$$,$$$\{2\}$$$,$$$\{4\}$$$.