In the acute triangle $ABC$, the sum of the distances from the vertices $B$ and $C$ to of the orthocenter $H$ is equal to $4r,$ where $r$ is the radius of the circle inscribed in this triangle. Find the perimeter of triangle $ABC$ if it is known that $BC=a$.

(Gryhoriy Filippovskyi)
Given an acute triangle \( \triangle ABC \) with orthocenter \( H \), we need to find the perimeter of the triangle given that the sum of the distances from the vertices \( B \) and \( C \) to the orthocenter \( H \) is equal to \( 4r \), where \( r \) is the radius of the inscribed circle, and \( BC = a \).

1. **Express the distances \( BH \) and \( CH \) in terms of the circumradius \( R \):**
   \[
   BH = 2R \cos \beta \quad \text{and} \quad CH = 2R \cos \gamma
   \]
   where \( R \) is the circumradius of \( \triangle ABC \).

2. **Sum the distances \( BH \) and \( CH \):**
   \[
   BH + CH = 2R \cos \beta + 2R \cos \gamma = 2R (\cos \beta + \cos \gamma)
   \]

3. **Given that \( BH + CH = 4r \), equate and simplify:**
   \[
   2R (\cos \beta + \cos \gamma) = 4r
   \]
   \[
   R (\cos \beta + \cos \gamma) = 2r
   \]

4. **Use the identity for the sum of cosines in terms of the angles of the triangle:**
   \[
   \cos \beta + \cos \gamma = 2 \cos \left( \frac{\beta + \gamma}{2} \right) \cos \left( \frac{\beta - \gamma}{2} \right)
   \]
   Since \( \alpha + \beta + \gamma = 180^\circ \), we have \( \beta + \gamma = 180^\circ - \alpha \), thus:
   \[
   \cos \left( \frac{\beta + \gamma}{2} \right) = \cos \left( \frac{180^\circ - \alpha}{2} \right) = \sin \left( \frac{\alpha}{2} \right)
   \]

5. **Substitute back into the equation:**
   \[
   R \left( 2 \sin \left( \frac{\alpha}{2} \right) \cos \left( \frac{\beta - \gamma}{2} \right) \right) = 2r
   \]
   \[
   R \sin \left( \frac{\alpha}{2} \right) \cos \left( \frac{\beta - \gamma}{2} \right) = r
   \]

6. **Use the relationship between the inradius \( r \) and the circumradius \( R \):**
   \[
   r = (p - a) \tan \left( \frac{\alpha}{2} \right)
   \]
   where \( p \) is the semi-perimeter of the triangle.

7. **Equate and simplify:**
   \[
   R \sin \left( \frac{\alpha}{2} \right) \cos \left( \frac{\beta - \gamma}{2} \right) = (p - a) \tan \left( \frac{\alpha}{2} \right)
   \]
   \[
   R \sin \left( \frac{\alpha}{2} \right) \cos \left( \frac{\beta - \gamma}{2} \right) = (p - a) \frac{\sin \left( \frac{\alpha}{2} \right)}{\cos \left( \frac{\alpha}{2} \right)}
   \]
   \[
   R \cos \left( \frac{\beta - \gamma}{2} \right) = \frac{p - a}{\cos \left( \frac{\alpha}{2} \right)}
   \]

8. **Simplify further:**
   \[
   R \cos \left( \frac{\alpha}{2} \right) \cos \left( \frac{\beta - \gamma}{2} \right) = p - a
   \]
   \[
   R \sin \left( \frac{\beta + \gamma}{2} \right) \cos \left( \frac{\beta - \gamma}{2} \right) = b + c - a
   \]
   \[
   R (\sin \beta + \sin \gamma) = b + c - a
   \]

9. **Using the identity \( \sin \beta + \sin \gamma = 2 \sin \left( \frac{\beta + \gamma}{2} \right) \cos \left( \frac{\beta - \gamma}{2} \right) \):**
   \[
   2R (\sin \beta + \sin \gamma) = 2(b + c - a)
   \]
   \[
   b + c = 2(b + c) - 2a
   \]
   \[
   b + c = 2a
   \]

10. **Find the perimeter of \( \triangle ABC \):**
    \[
    \text{Perimeter} = a + b + c = 3a
    \]

The final answer is \( \boxed{ 3a } \).