# Special Decision Tree: Official Solution

*English translation by SOTA – AI Community of the Russian original. Organisers who would like this translation removed can email sota.ai.community@gmail.com.*

*Task 7 of the school stage (Moscow) of the All-Russian School Olympiad (VsOSh) 2025/26 in artificial intelligence, grades 9–11: official solution (the statement is in a separate file). Original: [sol-ai-9-11-sch-msk-25-26.pdf](https://vos.olimpiada.ru/upload/files/Arhive_tasks/2025-26/school/ai/sol-ai-9-11-sch-msk-25-26.pdf).*

**Solution.**

A complete binary tree of depth $n$ has $2^n$ leaves. If we set to zero the edge on the "always left" path at level $a$, all paths passing through it become impossible: these are exactly the $2^{n-a}$ leaves below this edge. Similarly, setting to zero the edge on the "always right" path at level $b$ removes another $2^{n-b}$ leaves. These sets do not intersect (one cannot go always left and always right at the same time at the start of the path). In total, there remain

$$
2^n - 2^{n-a} - 2^{n-b}.
$$

```python
n, a, b = map(int, input().split())
x = 1
print((x << n) - (x << (n - a)) - (x << (n - b)))
```

*Translator's note: the paper gives no scoring criterion or maximum score for this task. The stated total of 112 points, minus the maxima of the other seven tasks (92 points), leaves 20.*
