3965.Funky Numbers

Time Limit: 1s Memory Limit: 256MB

As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as 3965_1.png, where k is some positive integer), and the coolest numbers are those that are representable as a sum of two triangular numbers.A well-known hipster Andrew adores everything funky and cool but unfortunately, he isn't good at maths. Given number n, help him define whether this number can be represented by a sum of two triangular numbers (not necessarily different)!

Input Format(From the terminal/stdin)

Input The first input line contains an integer n (1 \le n \le 109).

Output Format(To the terminal/stdout)

Output Print "YES" (without the quotes), if n can be represented as a sum of two triangular numbers, otherwise print "NO" (without the quotes).

Sample Input 1

Copy
256
   \n

Sample Output 1

Copy
YES
   \n

Sample Input 2

Copy
512
   \n

Sample Output 2

Copy
NO
  \n

Hints

In the first sample number 3965_2.png.In the second sample number 512 can not be represented as a sum of two triangular numbers.

Submit

请先 登录

© 2025 FAQs