I want to prove this:
Consider $n$ is an integer number and $n \ge 3$. We want to write numbers $1,2,3,...,r$ on the edges of $K_n$ and each number from $1$ to $r$ at least one time written on the $K_n$ edges. For each cycle with length 3 in $K_n$ two numbers that written on the edges of $C_3$ are equal and third number is greater than two numbers. Find the maximum of $r$ for any $n$ and prove that the number of ways to writing $1,2,3,...,r$ on the edges of $K_n$ is equal to $\frac{n!(n-1)!}{2^{n-1}}$.
I use double counting to find the maximum number of $r$: Every number from $1$ to $r$ is at least contain $n-2$ cycle with length 3 and every $C_3$ contains exactly $2$ numbers so $(n-2) \times r \le \binom{n}{3} \times 2 \rightarrow r \le \frac{n\times(n-1)}{3}$ but i don't know the maximum number exatcly. Anyone has any idea? Anyone has any idea about second part?
Here is solution to the first part.
So let $r(n)$ be maximal $r$ such that there exists a set $R\subset\mathbb{N}$ of size $r$ and a surjective function $f$, mapping edges of $K_n$ to $R$ in such a way that for any three edges $e_1, e_2, e_3$ forming a triangle in $K_n$ among $f(e_1), f(e_2), f(e_3)$ there are two equal numbers and one number which is greater than two others. This definition is clearly equivalent to yours.
I claim that $r(n) = n - 1$. To see that $r(n)\ge n - 1$ enumerate vertices of $K_n$ by numbers from 1 to $n$ somehow. Define $R=\{1, 2, \ldots, n - 1\}$ and $f(\{i, j\}) = \min\{i, j\}$.
To see that $r(n)\le n - 1$ we proceed by induction on $n$. The base $n = 2, 3$ is trivial. So assume that the claim is proved for all $m\le n$. Take $f$ witnessing $r(n)$. Let $e = \{u, v\}$ be an edge of $K_n$ such that $f(e) = r(n)$. Assume that all the other vertices are $w_1, \ldots, w_{n - 2}$. Define $$\alpha_i = f(\{u, w_i\}), \qquad \beta_i = f(\{v, w_i\}).$$ By looking at triangle $u, v, w_i$ we conclude that $\alpha_i = \beta_i < r(n)$ for all $i = 1, \ldots, n - 2$.
Further, say that $w_i$ is equivalent to $w_j$ if $\alpha_i = \alpha_j$. This is an equivalence relation on $\{w_1, \ldots, w_{n - 2}\}$. Assume that there are $k$ equivalence classes in this relation (note that $k = |\{\alpha_1, \ldots, \alpha_{n - 2}\}|$). Let $C_1, C_2, \ldots, C_k \subset \{w_1, \ldots, w_{n - 2}\}$ be these clases.
By induction hypothesis $f$, restricted to edges from $C_i$, takes at most $|C_i| - 1$ values (the size of $C_i$ is definitely smaller than $n$). On the other hand, I claim that if edge $e = \{a, b\}$ is such that there is no $C_i$ containing $e$, then $f(e)\in\{r(n), \alpha_1, \ldots, \alpha_{n - 2}\}$. Indeed, this is obvious if $e$ contains either $u$ or $v$. Now assume that $e = \{w_p, w_q\}$ for some $p, q\in\{1, 2, \ldots, n - 2\}$. Then $\alpha_p\neq \alpha_q$, because otherwise there is $C_i$ containing $e$. By looking at triangle $u, w_p, w_q$ we conclude that $f(e) = \min\{\alpha_p, \alpha_q\} \in \{r(n), \alpha_1, \ldots, \alpha_{n - 2}\}$.
Hence in total $f$ takes at most $$1 + |\{\alpha_1, \ldots, \alpha_{n - 2}\}| + \sum\limits_{i = 1}^k (|C_i| - 1) = 1 + k + (n - 2 - k) = n - 1$$ values, as required.