Remainder Minimization 2019

AtCoder
IDabc133_c
Time2000ms
Memory256MB
Difficulty
You are given two non-negative integers $L$ and $R$. We will choose two integers $i$ and $j$ such that $L \leq i < j \leq R$. Find the minimum possible value of $(i \times j) \text{ mod } 2019$. ## Constraints * All values in input are integers. * $0 \leq L < R \leq 2 \times 10^9$ ## Input Input is given from Standard Input in the following format: $L$ $R$ [samples]
Samples
Input #1
2020 2040
Output #1
2

When $(i, j) = (2020, 2021)$, $(i \times j) \text{ mod } 2019 = 2$.
Input #2
4 5
Output #2
20

We have only one choice: $(i, j) = (4, 5)$.
API Response (JSON)
{
  "problem": {
    "name": "Remainder Minimization 2019",
    "description": {
      "content": "You are given two non-negative integers $L$ and $R$. We will choose two integers $i$ and $j$ such that $L \\leq i < j \\leq R$. Find the minimum possible value of $(i \\times j) \\text{ mod } 2019$.",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc133_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given two non-negative integers $L$ and $R$. We will choose two integers $i$ and $j$ such that $L \\leq i < j \\leq R$. Find the minimum possible value of $(i \\times j) \\text{ mod } 2019$.\n\n## C...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments