
ACM


Power Products
You are given $n$ positive integers $a_1, \ldots, a_n$, and an integer $k \geq 2$. Count the number of pairs $i, j$ such that $1 […]


Rock Is Push
You are at the top left cell $(1, 1)$ of an $n \times m$ labyrinth. Your goal is to get to the bottom right cell […]

Tree Factory
Bytelandian Tree Factory produces trees for all kinds of industrial applications. You have been tasked with optimizing the production of a certain type of tree […]

Cursor Distance
There is a string $s$ of lowercase English letters. A cursor is positioned on one of the characters. The cursor can be moved with the […]


Optimal Subsequences (Hard Version)
This is the harder version of the problem. In this version, $1 \le n, m \le 2\cdot10^5$. You can hack this problem if you locked […]

Optimal Subsequences (Easy Version)
This is the easier version of the problem. In this version $1 \le n, m \le 100$. You can hack this problem only if you […]

Wrong Answer on Test 233 (Hard Version)
This is the harder version of the problem. In this version, $1 \le n \le 2\cdot10^5$. You can hack this problem if you locked it. […]

Wrong Answer on Test 233 (Easy Version)
This is the easier version of the problem. In this version $1 \le n \le 2000$. You can hack this problem only if you solve […]


Arson In Berland Forest
The Berland Forest can be represented as an infinite cell plane. Every cell contains a tree. That is, contained before the recent events. A destructive […]


Beautiful Sequence
An integer sequence is called beautiful if the difference between any two consecutive numbers is equal to $1$. More formally, a sequence $s_1, s_2, \ldots, s_{n}$ is […]

Beautiful Regional Contest
So the Beautiful Regional Contest (BeRC) has come to an end! $n$ students took part in the contest. The final standings are already known: the […]

Beautiful Mirrors with queries
Creatnx has $n$ mirrors, numbered from $1$ to $n$. Every day, Creatnx asks exactly one mirror “Am I beautiful?”. The $i$-th mirror will tell Creatnx […]

Beautiful Bracket Sequence (easy version)
This is the easy version of this problem. The only difference is the limit of $n$ – the length of the input string. In this […]

Beautiful Bracket Sequence (hard version)
This is the hard version of this problem. The only difference is the limit of $n$ – the length of the input string. In this […]

Beautiful League
A football league has recently begun in Beautiful land. There are $n$ teams participating in the league. Let’s enumerate them with integers from $1$ to […]