Let the set of all bijective functions taking positive integers to positive integers be $\mathcal B.$ Find all functions $\mathbf F:\mathcal B\to \mathbb R$ such that $$(\mathbf F(p)+\mathbf F(q))^2=\mathbf F(p \circ p)+\mathbf F(p\circ q)+\mathbf F(q\circ p)+\mathbf F(q\circ q)$$ for all $p,q \in \mathcal B.$ 

[i]Proposed by ckliao914[/i]
1. **Initial Setup and Simplification:**
   Given the functional equation:
   \[
   (\mathbf{F}(p) + \mathbf{F}(q))^2 = \mathbf{F}(p \circ p) + \mathbf{F}(p \circ q) + \mathbf{F}(q \circ p) + \mathbf{F}(q \circ q)
   \]
   for all \( p, q \in \mathcal{B} \), we start by setting \( p = q \):
   \[
   (\mathbf{F}(p) + \mathbf{F}(p))^2 = \mathbf{F}(p \circ p) + \mathbf{F}(p \circ p) + \mathbf{F}(p \circ p) + \mathbf{F}(p \circ p)
   \]
   Simplifying, we get:
   \[
   4\mathbf{F}(p)^2 = 4\mathbf{F}(p \circ p)
   \]
   Thus,
   \[
   \mathbf{F}(p)^2 = \mathbf{F}(p \circ p)
   \]

2. **Special Case for Identity Function:**
   Consider the identity function \(\text{id}\):
   \[
   \mathbf{F}(\text{id})^2 = \mathbf{F}(\text{id} \circ \text{id}) = \mathbf{F}(\text{id})
   \]
   This implies:
   \[
   \mathbf{F}(\text{id}) \in \{0, 1\}
   \]

3. **Case 1: \(\mathbf{F}(\text{id}) = 0\):**
   If \(\mathbf{F}(\text{id}) = 0\), then for any \( p \in \mathcal{B} \):
   \[
   (\mathbf{F}(p) + \mathbf{F}(\text{id}))^2 = \mathbf{F}(p \circ p) + 2\mathbf{F}(p) + \mathbf{F}(\text{id})
   \]
   Simplifies to:
   \[
   \mathbf{F}(p)^2 = \mathbf{F}(p \circ p) + 2\mathbf{F}(p)
   \]
   Since \(\mathbf{F}(p)^2 = \mathbf{F}(p \circ p)\), we get:
   \[
   \mathbf{F}(p)^2 = \mathbf{F}(p)^2 + 2\mathbf{F}(p)
   \]
   This implies:
   \[
   \mathbf{F}(p) = 0 \quad \text{for all} \quad p \in \mathcal{B}
   \]
   This is a valid solution.

4. **Case 2: \(\mathbf{F}(\text{id}) = 1\):**
   If \(\mathbf{F}(\text{id}) = 1\), then:
   \[
   \mathbf{F}(p)^2 = \mathbf{F}(p \circ p)
   \]
   Plugging this into the original equation:
   \[
   (\mathbf{F}(p) + \mathbf{F}(q))^2 = \mathbf{F}(p)^2 + \mathbf{F}(p \circ q) + \mathbf{F}(q \circ p) + \mathbf{F}(q)^2
   \]
   Simplifies to:
   \[
   2\mathbf{F}(p)\mathbf{F}(q) = \mathbf{F}(p \circ q) + \mathbf{F}(q \circ p)
   \]
   Let this be \( Q(p, q) \).

5. **Involution and Composition:**
   Consider \( Q(p, p^{-1}) \):
   \[
   2\mathbf{F}(p)\mathbf{F}(p^{-1}) = \mathbf{F}(\text{id}) + \mathbf{F}(\text{id}) = 2
   \]
   Thus:
   \[
   \mathbf{F}(p)\mathbf{F}(p^{-1}) = 1
   \]

6. **Further Simplification:**
   Combining \( Q(p, p^{-1} \circ q) \) and \( Q(p^{-1}, q \circ p) \):
   \[
   \mathbf{F}(q) + \mathbf{F}(p^{-1} \circ q \circ p) = 2\mathbf{F}(p)\mathbf{F}(p^{-1} \circ q) = 2\mathbf{F}(p^{-1})\mathbf{F}(q \circ p)
   \]
   Therefore:
   \[
   \mathbf{F}(p)^2\mathbf{F}(p^{-1} \circ q) = \mathbf{F}(q \circ p)
   \]
   Letting \( q = p \circ q \circ q \):
   \[
   \mathbf{F}(p)^2\mathbf{F}(q)^2 = \mathbf{F}(p \circ q \circ q \circ p)
   \]
   Similarly:
   \[
   \mathbf{F}(p)^2\mathbf{F}(q)^2 = \mathbf{F}(q \circ p \circ p \circ q)
   \]

7. **Final Conclusion:**
   Using these identities in \( Q(p \circ q, q \circ p) \):
   \[
   2\mathbf{F}(p \circ q)\mathbf{F}(q \circ p) = 2\mathbf{F}(p)^2\mathbf{F}(q)^2
   \]
   Combined with:
   \[
   \mathbf{F}(p \circ q) + \mathbf{F}(q \circ p) = 2\mathbf{F}(p)\mathbf{F}(q)
   \]
   We get:
   \[
   \mathbf{F}(p \circ q) = \mathbf{F}(q \circ p) = \mathbf{F}(p)\mathbf{F}(q)
   \]

8. **Verification:**
   Since \(\mathbf{F}(p \circ q) = \mathbf{F}(p)\mathbf{F}(q)\) for all \( p, q \in \mathcal{B} \), and \(\mathbf{F}(\text{id}) = 1\), we conclude that \(\mathbf{F}(p) = 1\) for all \( p \in \mathcal{B} \).

The final answer is \( \boxed{ \mathbf{F}(p) = 1 } \) for all \( p \in \mathcal{B} \).