DivRem Number

AtCoder
IDdiverta2019_d
Time2000ms
Memory256MB
Difficulty
Snuke received a positive integer $N$ from Takahashi. A positive integer $m$ is called a _favorite number_ when the following condition is satisfied: * The quotient and remainder of $N$ divided by $m$ are equal, that is, $\lfloor \frac{N}{m} \rfloor = N \bmod m$ holds. Find all favorite numbers and print the sum of those. ## Constraints * All values in input are integers. * $1 \leq N \leq 10^{12}$ ## Input Input is given from Standard Input in the following format: $N$ [samples]
Samples
Input #1
8
Output #1
10

There are two favorite numbers: $3$ and $7$. Print the sum of these, $10$.
Input #2
1000000000000
Output #2
2499686339916

Watch out for overflow.
API Response (JSON)
{
  "problem": {
    "name": "DivRem Number",
    "description": {
      "content": "Snuke received a positive integer $N$ from Takahashi. A positive integer $m$ is called a _favorite number_ when the following condition is satisfied: *   The quotient and remainder of $N$ divided by ",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "diverta2019_d"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Snuke received a positive integer $N$ from Takahashi. A positive integer $m$ is called a _favorite number_ when the following condition is satisfied:\n\n*   The quotient and remainder of $N$ divided by ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments