We label every edge of a simple graph with the difference of the degrees of its endpoints. If the number of vertices is $N$, what can be the largest value of the sum of the labels on the edges?

[i]Proposed by Dániel Lenger and Gábor Szűcs, Budapest[/i]

To find the largest value of the sum of the labels on the edges of a simple graph with \( N \) vertices, we need to analyze the structure of the graph and the labeling of its edges. Let's denote the graph by \( G \).

1. **Graph Structure**:
   - Let \( G \) be a graph achieving the largest sum of the labels.
   - We will show that \( G \) is composed of two parts: \( A \cup B \), where \( A \) is a complete subgraph and \( B \) is a trivial subgraph. Additionally, every vertex in \( A \) is incident to every vertex in \( B \).

2. **Vertex Degrees**:
   - For every vertex \( v_i \in G \), let \( m_i \) be the number of vertices in the neighborhood of \( v_i \) with a degree smaller than \( \deg(v_i) \).
   - Similarly, let \( M_i \) be the number of vertices in the neighborhood of \( v_i \) with a degree greater than \( \deg(v_i) \).

3. **Inequalities**:
   - **Claim**: Let \( v_i \) and \( v_j \) be vertices such that \( \deg(v_i) \geq \deg(v_j) \). Then:
     - If \( v_i \) is incident to \( v_j \), then \( \overline{M_j} \leq m_i \).
     - If \( v_i \) is not incident to \( v_j \), then \( \overline{m_i} \leq M_j \).
   - **Proof**: This can be shown by considering the effect of adding or removing the edge \( v_iv_j \) and counting the number of "points" lost.

4. **Vertex Relationships**:
   - **Claim**: Consider vertices \( v_i, v_j, v_l \) with \( \deg(v_i) \geq \deg(v_j) \geq \deg(v_l) \). We have two cases:
     - If \( v_i \) is not incident to \( v_j \), and \( v_j \) is incident to \( v_l \), then \( \overline{M_i} \leq M_l \).
     - If \( v_i \) is incident to \( v_j \), and \( v_j \) is not incident to \( v_l \), then \( \overline{m_i} \leq m_l \).
   - **Proof**: This follows from the first claim and the fact that \( m_i \leq \overline{m_i} \).

5. **Subgraph Structure**:
   - Let \( v_m \) be the vertex of minimal degree in \( G \). Define \( A = N(v_m) \) and \( B = G \setminus N(v_m) \).
   - **Claim**: The subgraph \( A \) is complete and \( B \) is trivial.
   - **Proof**: Suppose two vertices \( v_i \) and \( v_j \) in \( A \) are not incident to each other and \( \deg(v_i) \geq \deg(v_j) \geq \deg(v_m) \). Then \( \overline{m_i} \leq m_l = 0 \), which is a contradiction. Similarly, it can be shown that \( B \) is trivial.

6. **Incident Vertices**:
   - **Claim**: Every vertex of \( A \) is incident to every vertex of \( B \).
   - **Proof**: If a vertex in \( B \) is not incident to one in \( A \), this would contradict the minimality of \( v_m \).

7. **Maximizing the Sum**:
   - The sum of the labels on the edges is given by \( |A||B|(|B|-1) \).
   - To maximize this sum, we need to find the optimal sizes of \( A \) and \( B \) such that \( |A| + |B| = N \).
   - This is maximized when \( |A| = \left\lfloor \frac{N+1}{3} \right\rfloor \) and \( |B| = \left\lceil \frac{2N-1}{3} \right\rceil \).

The final answer is \( \boxed{ |A||B|(|B|-1) } \) where \( |A| = \left\lfloor \frac{N+1}{3} \right\rfloor \) and \( |B| = \left\lceil \frac{2N-1}{3} \right\rceil \).