192A.md (1290B)
1 Source: https://codeforces.com/problemset/problem/192/A 2 3 A. Funky Numbers 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as , where *k* is some positive integer), and the coolest numbers are those that are representable as a sum of two triangular numbers. 22 23 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)! 24 25 Input 26 27 The first input line contains an integer *n* (1 ≤ *n* ≤ 109). 28 29 Output 30 31 Print "YES" (without the quotes), if *n* can be represented as a sum of two triangular numbers, otherwise print "NO" (without the quotes). 32 33 Examples 34 35 Input 36 37 ``` 38 256 39 ``` 40 41 Output 42 43 ``` 44 YES 45 ``` 46 47 Input 48 49 ``` 50 512 51 ``` 52 53 Output 54 55 ``` 56 NO 57 ``` 58 59 Note 60 61 In the first sample number . 62 63 In the second sample number 512 can not be represented as a sum of two triangular numbers.