There are $$$n$$$ students in a class. The teacher has decided to form a team from among them to participate in a hackathon. The team can consist of anywhere from two to five members. The teacher now faces the challenging task of evaluating every possible team composition and selecting one. Write a program to calculate the number of different team compositions that the teacher will need to evaluate.
A single integer $$$n$$$ is provided as input.
Output a single integer — the answer.
Subtask 1 (up to 50 points): $$$2 \le n \le 10$$$
Subtask 2 (up to 50 points): $$$10 \lt n \le 100$$$
3
4
It is known that a certain unknown number, when divided by $$$a$$$, leaves a remainder of $$$b$$$. What remainders could be obtained when this same number is divided by $$$c$$$?
Three integers $$$a$$$, $$$b$$$, and $$$c$$$ are provided, each on a separate line.
Output all possible remainders that could result from division by $$$c$$$, listed in ascending order.
Subtask 1 (up to 40 points): $$$1 \le a, c \le 100$$$, $$$0 \le b \lt a$$$.
Subtask 2 (up to 60 points): $$$1 \le a, c \le 10^5$$$, $$$0 \le b \lt a$$$.
634
1 3
In the example, the unknown number could be, for instance, 15 — when divided by 4, it leaves a remainder of 3. Another possible number is 21; when divided by 4, it leaves a remainder of 1. All other valid numbers also yield only 1 or 3 as remainders.
Vasya is studying modular arithmetic. To practice, he calculated the sum $$$1^1 + 2^2 + \dots + n^n$$$ modulo $$$m$$$. In other words, he found the remainder when this sum is divided by $$$m$$$.
Vasya obtained the result $$$r$$$. However, he made a mistake during his calculation — he omitted one of the terms. Determine the index of the term that he left out.
Three integers $$$n$$$, $$$m$$$, and $$$r$$$ are provided, each on a separate line ($$$2 \le n \le 10^5$$$, $$$1 \le m \le 10^9$$$, $$$0 \le r \lt m$$$).
Output an integer from $$$1$$$ to $$$n$$$ representing the index of the missing term. If there are multiple valid answers, output the smallest one. If no solution exists, output $$$0$$$.
Subtask 1 (up to 30 points): $$$n \le 5$$$
Subtask 2 (up to 30 points): $$$n \le 100$$$
Subtask 3 (up to 40 points): $$$n \le 10^5$$$
3108
2
3102
0
Let us call a natural number "simplified" if it is the product of exactly two prime numbers (not necessarily distinct). Find all simplified numbers in the range from $$$1$$$ to $$$n$$$.
An integer $$$n$$$ is given as input.
Output all simplified numbers in the range from $$$1$$$ to $$$n$$$ in ascending order.
Subtask 1 (up to 40 points): ($$$1 \le n \le 1000$$$)
Subtask 2 (up to 60 points): ($$$1 \le n \le 10^5$$$)
8
4 6
Write a program to create rebuses of the form x+y=z, where x, y, and z are strings of length $$$n$$$ consisting of uppercase Latin letters. Each letter represents a specific digit; identical letters must represent the same digit, and distinct letters must represent different digits. The rebus must contain exactly $$$k$$$ distinct letters.
Example of a rebus for $$$n=2$$$, $$$k=4$$$: AB+BC=DB. A possible solution for this rebus is: 23+30=53.
The input consists of two integers, $$$n$$$ and $$$k$$$, each on a separate line ($$$1 \le n \le 9$$$, $$$1 \le k \le 10$$$).
In the first line, print the rebus, in the second line, any one of its solutions. Note that numbers consisting of two or more digits cannot begin with zero. There should be no spaces in the output.
If multiple solutions exist, you may output any one of them. If no such rebus exists for the given $$$n$$$ and $$$k$$$ that has at least one solution, output "NO" (in uppercase letters, without quotation marks).
Subtask 1 (up to 28 points): $$$n \le 4$$$
Subtask 2 (up to 32 points): $$$n \le 7$$$
Subtask 3 (up to 40 points): $$$n \le 9$$$
24
AB+BC=DB 23+30=53
21
NO