eolymp
bolt
Try our new interface for solving problems
Problems

Fun function

Fun function

Find the value of the function $$ f(x, y) = \begin{cases} 0, x \le 0~or~y \le 0 \\ f(x - 1, y - 2) + f(x - 2, y - 1) + 2, x \le y \\ f(x - 2, y - 2) + 1, x > y \end{cases} $$ \InputFile Two integers $x, y~(0 \le x, y \le 50)$. \OutputFile Print the value of the function $f(x, y)$.
Time limit 1 second
Memory limit 128 MiB
Input example #1
2 3
Output example #1
4
Input example #2
34 12 
Output example #2
6
Author Mykhailo Medvediev