Find all functions $f:\mathbb{Z}_{>0}\mapsto\mathbb{Z}_{>0}$ such that 

$$xf(x)+(f(y))^2+2xf(y)$$ 
is perfect square for all positive integers $x,y$. 

**This problem was proposed by me for the BMO 2017 and it was shortlisted. We then used it in our TST. 
1. **Define the problem and initial condition:**
   We need to find all functions \( f: \mathbb{Z}_{>0} \to \mathbb{Z}_{>0} \) such that 
   \[
   P(x, y) : xf(x) + (f(y))^2 + 2xf(y)
   \]
   is a perfect square for all positive integers \( x \) and \( y \).

2. **Initial evaluation:**
   Evaluate \( P(1, 1) \):
   \[
   P(1, 1) : 1 \cdot f(1) + (f(1))^2 + 2 \cdot 1 \cdot f(1) = f(1) + (f(1))^2 + 2f(1) = (f(1) + 1)^2
   \]
   This implies:
   \[
   f(1) + 1 = k \quad \text{for some integer } k
   \]
   Therefore:
   \[
   f(1) = k - 1
   \]
   Since \( f(1) \) must be a positive integer, the smallest value for \( k \) is 2, giving:
   \[
   f(1) = 1
   \]

3. **Claim: \( f(x) = x \) for all \( x \in \mathbb{Z}_{>0} \):**
   Assume \( f(x) = x \) for \( x = 1, 2, \ldots, n-1 \). We need to show \( f(n) = n \).

4. **Case 1: \( f(n) < n \):**
   Let \( f(n) = n - k \) where \( k \) is a positive integer. Consider:
   \[
   P(n, \left\lfloor \frac{1}{4}k \right\rfloor + 1)
   \]
   This gives:
   \[
   n f(n) + (f(\left\lfloor \frac{1}{4}k \right\rfloor + 1))^2 + 2n f(\left\lfloor \frac{1}{4}k \right\rfloor + 1)
   \]
   Since \( f(\left\lfloor \frac{1}{4}k \right\rfloor + 1) = \left\lfloor \frac{1}{4}k \right\rfloor + 1 \), we have:
   \[
   n(n - k) + (\left\lfloor \frac{1}{4}k \right\rfloor + 1)^2 + 2n(\left\lfloor \frac{1}{4}k \right\rfloor + 1)
   \]
   Simplifying:
   \[
   n^2 - nk + (\left\lfloor \frac{1}{4}k \right\rfloor + 1)^2 + 2n(\left\lfloor \frac{1}{4}k \right\rfloor + 1)
   \]
   This expression must be a perfect square. However, it lies between two consecutive squares, leading to a contradiction.

5. **Case 2: \( f(n) > n \):**
   Let \( f(n) = n + t \) where \( t \) is a positive integer. Consider:
   \[
   P(n, 1) \quad \text{and} \quad P(n, 2)
   \]
   This gives:
   \[
   n(n + t) + (f(1))^2 + 2n f(1) = a^2
   \]
   and:
   \[
   n(n + t) + (f(2))^2 + 2n f(2) = b^2
   \]
   Since \( f(1) = 1 \) and \( f(2) = 2 \), we have:
   \[
   n(n + t) + 1 + 2n = a^2
   \]
   and:
   \[
   n(n + t) + 4 + 4n = b^2
   \]
   Simplifying:
   \[
   n^2 + nt + 2n + 1 = a^2
   \]
   and:
   \[
   n^2 + nt + 4n + 4 = b^2
   \]
   Subtracting these equations:
   \[
   b^2 - a^2 = 2n + 3
   \]
   Since \( b > a \), if \( a > n + 1 \), then:
   \[
   b^2 - a^2 \geq 2n + 5
   \]
   This leads to a contradiction. Therefore, \( a = n + 1 \) and \( t = 0 \).

6. **Conclusion:**
   Since both cases lead to contradictions unless \( f(n) = n \), we conclude:
   \[
   f(x) = x \quad \text{for all } x \in \mathbb{Z}_{>0}
   \]

The final answer is \( \boxed{ f(x) = x } \)