Sum and Product

AtCoder
IDarc108_a
Time2000ms
Memory256MB
Difficulty
Given are integers $S$ and $P$. Is there a pair of positive integers $(N,M)$ such that $N + M = S$ and $N \times M = P$? ## Constraints * All values in input are integers. * $1 \leq S,P \leq 10^{12}$ ## Input Input is given from Standard Input in the following format: $S$ $P$ [samples]
Samples
Input #1
3 2
Output #1
Yes

*   For example, we have $N+M=3$ and $N \times M =2$ for $N=1,M=2$.
Input #2
1000000000000 1
Output #2
No

*   There is no such pair $(N,M)$.
API Response (JSON)
{
  "problem": {
    "name": "Sum and Product",
    "description": {
      "content": "Given are integers $S$ and $P$. Is there a pair of positive integers $(N,M)$ such that $N + M = S$ and $N \\times M = P$?",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc108_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Given are integers $S$ and $P$. Is there a pair of positive integers $(N,M)$ such that $N + M = S$ and $N \\times M = P$?\n\n## Constraints\n\n*   All values in input are integers.\n*   $1 \\leq S,P \\leq 10^...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments