~/algor $ cat problems/funksiya-sanalar-farqi
Day of the year
Write a function DayOfYear(d, m, y) that returns which day of the year $y$ the $d$-th day of month $m$ is (January $1$ is day $1$). Days in the months: January $31$, February $28$ ($29$ in a leap year), March $31$, April $30$, May $31$, June $30$, July $31$, August $31$, September $30$, October $31$, November $30$, December $31$. A year is a leap year if it is divisible by $4$ but not by $100$, or if it is divisible by $400$.
Example 1: DayOfYear(1, 3, 2024) → 61 — $31 + 29 + 1 = 61$, $2024$ is a leap year.
Example 2: DayOfYear(31, 12, 2023) → 365
Write only the function body.
Input
One line with three positive integers $d$, $m$ and $y$ — the arguments of the function.
Output
The value returned by the function: an integer.
Note
$1 \le d \le 31$
$1 \le m \le 12$
$1900 \le y \le 2100$
The date exists.
Examples
1 3 2024
61
31 12 2023
365