Let's determine all functions $f: \mathbf{R} \rightarrow \mathbf{R}$ such that

$$
f(x-f(y))=f(f(y))+x f(y)+f(x)-1
$$

holds for all $x, y \in \mathbf{R}$.
Substituting $f(y)$ for $x$ and using the notation $k=f(0)$:

$$
f(0)=f(f(y))+(f(y))^{2}+f(f(y))-1 f(f(y))=\frac{1}{2}\left(k+1-(f(y))^{2}\right)
$$

Substituting this into the original condition:

$$
f(x-f(y))=\frac{1}{2}\left(k-1-(f(y))^{2}\right)+x f(y)+f(x)
$$

Let $g(x)=f(x)+\frac{x^{2}}{2}$. Then

$g(x-f(y))=f(x-f(y))+\frac{(x-f(y))^{2}}{2}==\frac{1}{2}\left(k-1-(f(y))^{2}\right)+x f(y)+g(x)-\frac{x^{2}}{2}+\frac{(x-f(y))^{2}}{2}, g(x-f(y))=x f(y)+g(x)$

First, we prove that $k=1$. Since the identically zero function is not a solution, there exists a $y \in \mathbf{R}$ such that $f(y) \neq 0$, so we can substitute $x=\frac{1}{f(y)}-$ into the original formula:

$$
f(x-f(y))=f(f(y))+f(x), \quad \text { that is } \quad f(a)=f(b)+f(c)
$$

This gives us an equality of the form

$$
g(x-f(a))=g(x)+\frac{k-1}{2}, \quad g((x-f(b))-f(c))=g(x-f(b))+\frac{k-1}{2}=g(x)+k-1
$$

From the equality of these two, we get $k-1=\frac{k-1}{2}$, hence $k=1$.

Then $g(x-f(y))=g(x)$, so $f(x)$ is a period of $g$ for all $x$. Moreover, $f(0)=k=1$, from which

$$
f(1)=f(f(0))=\frac{1}{2}(1+1-1)^{2}=\frac{1}{2}
$$

so $\frac{1}{2}$ is a function value, and thus a period of $g$. But

$$
f(x-1)=f(x-f(0))=f(f(0))+x f(0)+f(x)-1=\frac{1}{2}+x+f(x)-1=f(x)-\frac{1}{2}+x
$$

is also a function value, and thus a period of $g$.

We have found that $g$ has periods $f(x), f(x-1)$, and $\frac{1}{2}$, so $f(x)-f(x-1)+\frac{1}{2}$, which is $x$, is also a period.

Thus, $g$ is periodic for every number and can only be constant.

$g(0)=f(0)+\frac{0^{2}}{2}=1$, so $g(x)=1$, from which $f(x)=1-\frac{x^{2}}{2}$.

By substitution, we can verify that this is indeed a solution.

Solution by Terpai Tamás