P5737 [Shenji 7. Example 3] Leap Year Display

Description

Given $x, y$, output the number of leap years in the interval $[x, y]$, and on the next line output all leap year numbers, separated by spaces.

Input Format

Input two positive integers $x, y$, separated by a space.

Output Format

On the first line, output a positive integer representing the number of leap years in the interval $[x, y]$. On the second line, output several positive integers: all leap year numbers in monotonically increasing order by year.

Explanation/Hint

Constraints: the testdata guarantees that $1582 \le x < y \le 3000$. Translated by ChatGPT 5