IMO 2025 P1

A line in the plane is called sunny if it is not parallel to any of the x –axis, the y –axis, or the line x+y=0.

Let n\ge3 be a given integer. Determine all nonnegative integers k such that there exist n distinct lines in the plane satisfying both of the following:
for all positive integers a and b with a+b\le n+1, the point (a,b) lies on at least one of the lines; and
exactly k of the n lines are sunny.

Proposed by Linus Tang, USA