Qualifying round of the 11th Regional Olympiad for the Governor’s Prize 2026, grades 9-10, Vologda Region
1. Hackathon Team
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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.

Input

A single integer $$$n$$$ is provided as input.

Output

Output a single integer — the answer.

Scoring

Subtask 1 (up to 50 points): $$$2 \le n \le 10$$$

Subtask 2 (up to 50 points): $$$10 \lt n \le 100$$$

Example
Input
3
Output
4

2. Remainders
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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$$$?

Input

Three integers $$$a$$$, $$$b$$$, and $$$c$$$ are provided, each on a separate line.

Output

Output all possible remainders that could result from division by $$$c$$$, listed in ascending order.

Scoring

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$$$.

Example
Input
6
3
4
Output
1 3
Note

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.

3. Modular Arithmetic
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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.

Input

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

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$$$.

Scoring

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$$$

Examples
Input
3
10
8
Output
2
Input
3
10
2
Output
0

4. Simplified Numbers
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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$$$.

Input

An integer $$$n$$$ is given as input.

Output

Output all simplified numbers in the range from $$$1$$$ to $$$n$$$ in ascending order.

Scoring

Subtask 1 (up to 40 points): ($$$1 \le n \le 1000$$$)

Subtask 2 (up to 60 points): ($$$1 \le n \le 10^5$$$)

Example
Input
8
Output
4
6

5. Rebus
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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.

Input

The input consists of two integers, $$$n$$$ and $$$k$$$, each on a separate line ($$$1 \le n \le 9$$$, $$$1 \le k \le 10$$$).

Output

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).

Scoring

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$$$

Examples
Input
2
4
Output
AB+BC=DB
23+30=53
Input
2
1
Output
NO