2026

AtCoder
IDabc439_c
Time2000ms
Memory256MB
Difficulty
A positive integer $n$ is called a **good integer** when it satisfies the following condition: * There exists exactly one pair of integers $(x,y)$ that satisfies $0 \lt x \lt y$ and $x^2+y^2=n$. For example, when $n=2026$, it can be verified that $(x,y)=(1,45)$ is the only pair of integers that satisfies $0 \lt x \lt y$ and $x^2+y^2=n$. Thus, $2026$ is a good integer. You are given a positive integer $N$. Enumerate all good integers not exceeding $N$. ## Constraints * $1 \leq N \leq 10^7$ * $N$ is an integer. ## Input The input is given from Standard Input in the following format: $N$ [samples]
Samples
Input #1
10
Output #1
2
5 10

$(x,y)=(1,2)$ is the only pair of integers that satisfies $0 \lt x \lt y$ and $x^2+y^2=5$, so $5$ is a good integer.  
$(x,y)=(1,3)$ is the only pair of integers that satisfies $0 \lt x \lt y$ and $x^2+y^2=10$, so $10$ is a good integer.  
These are the only two good integers not exceeding $N$.
Input #2
1
Output #2
0
Input #3
50
Output #3
14
5 10 13 17 20 25 26 29 34 37 40 41 45 50
API Response (JSON)
{
  "problem": {
    "name": "2026",
    "description": {
      "content": "A positive integer $n$ is called a **good integer** when it satisfies the following condition: *   There exists exactly one pair of integers $(x,y)$ that satisfies $0 \\lt x \\lt y$ and $x^2+y^2=n$. F",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc439_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "A positive integer $n$ is called a **good integer** when it satisfies the following condition:\n\n*   There exists exactly one pair of integers $(x,y)$ that satisfies $0 \\lt x \\lt y$ and $x^2+y^2=n$.\n\nF...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments