Max GCD 2

AtCoder
IDjsc2021_c
Time2000ms
Memory256MB
Difficulty
Given are integers $A$ and $B$. Find the maximum possible value of $\gcd(x, y)$ when we choose integers $x$ and $y$ so that $A ≤ x < y ≤ B$. Here, $\gcd(x, y)$ denotes the greatest common divisor of $x$ and $y$. ## Constraints * $A$ and $B$ are integers. * $1 ≤ A < B ≤ 2 \times 10^5$ ## Input Input is given from Standard Input in the following format: $A$ $B$ [samples]
Samples
Input #1
2 4
Output #1
2

We have three ways to choose $(x, y)$ such that $A ≤ x < y ≤ B$: $(2,3), (2,4), (3,4)$, where the greatest common divisors are $1, 2, 1$, respectively, so the maximum possible value is $2$.
Input #2
199999 200000
Output #2
1

We have $\gcd(199999, 200000) = 1$.
Input #3
101 139
Output #3
34
API Response (JSON)
{
  "problem": {
    "name": "Max GCD 2",
    "description": {
      "content": "Given are integers $A$ and $B$. Find the maximum possible value of $\\gcd(x, y)$ when we choose integers $x$ and $y$ so that $A ≤ x < y ≤ B$.   Here, $\\gcd(x, y)$ denotes the greatest common divisor of",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "jsc2021_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Given are integers $A$ and $B$. Find the maximum possible value of $\\gcd(x, y)$ when we choose integers $x$ and $y$ so that $A ≤ x < y ≤ B$.  \nHere, $\\gcd(x, y)$ denotes the greatest common divisor of...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments