As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as <image>, 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

The first input line contains an integer n (1 ≤ n ≤ 109).

Output

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

Examples

Input

256


Output

YES


Input

512


Output

NO

Note

In the first sample number <image>.

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

Source: codeforces | Difficulty: EASY
Tags: Sorting

Implementation

Complete search


Solutions:
n = int(input())

def f(n):
	return n * (n + 1) // 2
memo = {}
i = 1
limit = 10 ** 9
while True:
	tmp = f(i)
	if tmp > limit:
		break
	memo[tmp] = 1
	i += 1
for i in memo:
	if i > n:
		break
	if n - i in memo:
		print('YES')
		exit(0)
print('NO')


def check(arr, arr_size, sum):
	s = set()
	if sum % 2 == 0 and sum // 2 in arr:
		return True
	for i in range(0, arr_size):
		temp = sum - arr[i]
		if temp in s:
			return True
		s.add(arr[i])
	return False
a = []
l = 0
for i in range(1, 150000):
	a.append(i + l)
	l += i
x = int(input())
print('YES' if check(a, len(a), x) else 'NO')


from itertools import combinations
n = int(input())
s = set()
for i in range(1, 50000):
	x = i * (i + 1) // 2
	s.add(x)
for i in s:
	if n - i in s:
		print('YES')
		exit()
print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
d = {}
for i in range(1, 10 * int((10 ** 9) ** 0.5)):
	d[i * (i + 1) // 2] = 1
for i in d:
	if n - i in d:
		print('YES')
		exit()
print('NO')


k = set([i * (i + 1) // 2 for i in range(1, 45000)])
n = int(input())
f = set([n - i for i in k])
t = k & f
if t:
	print('YES')
else:
	print('NO')


n = int(input())

def triangular_number(k):
	return int(k * (k + 1) / 2)
found = False
for i in range(1, n):
	a = triangular_number(i)
	b = n - a
	try:
		found = int((2 * b + 0.25) ** 0.5 - 0.5) == (2 * b + 0.25) ** 0.5 - 0.5 and int((2 * b + 0.25) ** 0.5 - 0.5) > 0
	except:
		found = False
		break
	if found:
		print('YES')
		break
if not found:
	print('NO')


l = []
for i in range(1, 10 ** 5):
	l.append(i * (i + 1) // 2)
i = 0
f = 0
n = int(input())
j = 10 ** 5 - 5
while i <= j:
	if l[i] + l[j] == n:
		f = 1
		break
	elif l[i] + l[j] < n:
		i += 1
	else:
		j -= 1
if f == 0:
	print('NO')
else:
	print('YES')


import math
n = int(input())
flag = False
x = int(math.sqrt(2 * n))
flag = False
for i in range(1, x + 1):
	a = 2 * n - i * (i + 1)
	if a > 0:
		b = math.sqrt(1 + 4 * a)
		if (b - 1) / 2 == int((b - 1) / 2):
			flag = True
			print('YES')
	if flag == True:
		break
if flag == False:
	print('NO')


n = int(input())
st = set([p * (p + 1) / 2 for p in range(1, 55000)])
f = 0
for i in st:
	if n - i in st:
		f = 1
		break
if f == 1:
	print('YES')
else:
	print('NO')


def binarySearch(arr, l, r, x):
	while l <= r:
		mid = int(l + (r - l) / 2)
		if arr[mid] == x:
			return True
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return False
max = 100000 + 1
n = int(input())
array = [0 for k in range(max)]
array[0] = 0
found = False
for i in range(1, max):
	array[i] = array[i - 1] + i
for i in range(1, max):
	if binarySearch(array, 1, max, n - array[i]):
		print('YES')
		found = True
		break
if not found:
	print('NO')


def checkTriangularSumRepresentation(n):
	tri = list()
	i = 1
	while 1:
		x = i * (i + 1) // 2
		if x >= n:
			break
		tri.append(x)
		i += 1
	for tm in tri:
		if n - tm in tri:
			return True
	return False
n = int(input())
if checkTriangularSumRepresentation(n):
	print('YES')
else:
	print('NO')


n = int(input())
import math
m = math.sqrt(n)
a = set([k * (k + 1) // 2 for k in range(1, int(2 * m))])
for i in a:
	if n - i in a:
		print('YES')
		exit()
print('NO')


n = int(input())
j = 1
sum = 1
ans = 'NO'
while j <= n // 2:
	k = n - j
	p = int((8 * k + 1) ** 0.5)
	if p * p == 8 * k + 1:
		ans = 'YES'
		break
	sum += 1
	j += sum
print(ans)


import math

def funkyNumbers():
	n = int(input())
	i = 1
	con = 0
	for i in range(1, n):
		if i * (i + 1) > n:
			break
		k = int(round(math.sqrt(n * 2 - i * (i + 1))))
		if i * (i + 1) + k * (k + 1) == 2 * n:
			return 'YES'
	return 'NO'
print(funkyNumbers())


arr = [1] * 10 ** 5
d = {}
for i in range(1, 10 ** 5):
	arr[i] = i * (i + 1) // 2
	d[arr[i]] = 1
n = int(input())
for i in arr:
	a = i
	b = n - i
	if b <= 0:
		break
	if b in d:
		print('YES')
		exit()
print('NO')


n = int(input())
yep = {}
for i in range(1, 10 ** 5 + 1):
	yep[i * (i + 1) // 2] = 1
for i in yep:
	if n - i in yep:
		print('YES')
		exit()
print('NO')


hash_set = set()
for i in range(1, 10 ** 5):
	hash_set.add(i * (i + 1) // 2)
n = int(input())
if n == 1:
	print('NO')
	exit()
i = 1
while True:
	temp = i * (i + 1) // 2
	if temp > n:
		print('NO')
		break
	elif n - temp in hash_set:
		print('YES')
		break
	i += 1


import sys
import os
from math import *
input = sys.stdin.buffer.readline
n = int(input())
x = int(max(int((-1 + sqrt(1 + 8 * n)) // 2), (-1 - sqrt(1 + 8 * n)) // 2))
z = 0
while x > 0:
	c = n - x * (x + 1) // 2
	if c == 0:
		x -= 1
	else:
		k = int(max(int((-1 + sqrt(1 + 8 * c)) // 2), (-1 - sqrt(1 + 8 * c)) // 2))
		if k * (k + 1) // 2 == c:
			z = 1
			break
		else:
			x -= 1
if z == 1:
	print('YES')
else:
	print('NO')


n = int(input())
s = set()
c = 0
for i in range(1, 50000):
	a = i * (i + 1) // 2
	s.add(a)
for j in s:
	if n - j in s:
		c = c + 1
		print('YES')
		exit()
print('NO')


import math
n = int(input())
x = 0
isFunky = False
for i in range(1, n):
	if i * (i + 1) > n:
		break
	x = int(round(math.sqrt(n * 2 - i * (i + 1))))
	if i * (i + 1) + x * (x + 1) == 2 * n:
		isFunky = True
		break
if isFunky:
	print('YES')
else:
	print('NO')


def binary_search(arr, low, high, x):
	if high >= low:
		mid = (high + low) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binary_search(arr, low, mid - 1, x)
		else:
			return binary_search(arr, mid + 1, high, x)
	else:
		return -1
n = int(input())
n = n * 2
final = 1
check = []
root = int(((4 * (n - 2) + 1) ** 0.5 - 1) / 2)
i = 1
j = root
cong = root ** 2 + root
if n == 2:
	print('NO')
	final = 0
while i <= j and final == 1:
	init = i * i + i
	number = n - init
	if binary_search(check, 0, len(check) - 1, number) != -1:
		print('YES')
		final = 0
		break
	else:
		while cong + init >= n and final == 1:
			if cong == number:
				print('YES')
				final = 0
				break
			else:
				check.append(cong)
				j -= 1
				cong = j ** 2 + j
		i += 1
if final == 1:
	print('NO')


n = int(input())
a = []
b = []
i = int(1)
f = 0
while 1:
	a.append(int(i * (i + 1) / 2))
	if a[len(a) - 1] >= n:
		break
	i = i + 1
for i in range(len(a)):
	b.append(n - a[i])
b.sort()
print('YES') if set(a) & set(b) else print('NO')


T = {k * (k + 1) // 2 for k in range(1, 44721)}
n = int(input())
if any((n - j in T for j in T)):
	print('YES')
else:
	print('NO')


bruh = set([(i + 1) * i / 2 for i in range(1, 50001)])
n = int(input())
if any((n - t in bruh for t in bruh)):
	print('YES')
else:
	print('NO')


n = int(input())
fs = set()
for i in range(n):
	f = i * (i + 1) // 2
	if f < n:
		fs.add(f)
		if n - f in fs:
			print('YES')
			exit()
	else:
		break
print('NO')


def main():
	n = int(input())
	s = set()
	count = 1
	k = count * (count + 1) // 2
	while k <= n:
		s.add(k)
		count += 1
		k = count * (count + 1) // 2
	for i in s:
		if n - i in s:
			print('YES')
			return
	print('NO')
main()


import math
n = int(input())
first = 0
flag = 0
for i in range(1, int(math.sqrt(2 * n))):
	first += i
	t = 2 * (n - first)
	k = int(math.sqrt(t))
	if k * (k + 1) == t:
		print('YES')
		flag = 1
		break
if flag == 0:
	print('NO')


def code(n):
	return n * (n + 1) // 2
n = int(input())
k = 1
a = set()
while code(k) <= n:
	a.add(code(k))
	k += 1
for i in a:
	if n - i in a:
		print('YES')
		break
else:
	print('NO')


def trinum(n):
	return n * (n + 1) // 2
n = int(input())
s = set()
f = True
i = 1
while f:
	tri = trinum(i)
	if tri <= n:
		s.add(tri)
		i += 1
	else:
		break
fs = False
for i in s:
	if n - i in s:
		print('YES')
		quit()
print('NO')


from math import ceil, sqrt
n = int(input())

def value(y):
	y = y * (y + 1) / 2
	y = n - y
	return y

def check(y):
	y = 8 * y + 1
	y = sqrt(y)
	if y == ceil(y):
		return True
	else:
		return False

def main():
	y = 1
	while value(y) > 0:
		if check(value(y)):
			return print('YES')
		y += 1
	return print('NO')
main()


import bisect
n = int(input()) * 2
triangles = [i * (i + 1) for i in range(1, int(n ** 0.5) + 2)]
for triangle in triangles:
	tri = triangles[bisect.bisect_left(triangles, n - triangle)]
	if tri <= triangle or tri + triangle == n:
		break
if tri + triangle == n:
	print('YES')
else:
	print('NO')


import math
n = int(input())

def isTriangular(n):
	c = 0
	x = 8 * n + 1
	if math.sqrt(x) == int(math.sqrt(x)):
		c = 1
	return c
ans = 0
z = n // 2
t = 1
i = 1
while i <= z:
	if isTriangular(n - i) == 1 and isTriangular(i) == 1:
		ans = 1
		print('YES')
		break
	t += 1
	i += t
if ans == 0:
	print('NO')


n = int(input())
m = 1
arr = []
while True:
	mm = m * (m + 1) // 2
	if mm > n:
		break
	arr.append(mm)
	m += 1
ll = len(arr)
flag = 0
for i in range(ll):
	curr = arr[i]
	req = n - curr
	l = i
	r = ll - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] >= req:
			r = mid - 1
		else:
			l = mid + 1
	if i <= l < ll and arr[l] == req:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


N = 10 ** 9
tri_nums = set()
i = 1
while i * (i + 1) // 2 <= N:
	tri_nums.add(i * (i + 1) // 2)
	i += 1
a = int(input())
for num in tri_nums:
	if a - num in tri_nums:
		print('YES')
		break
else:
	print('NO')


import math
n = int(input())
s = []
flag = 0
for i in range(1, 10 ** 5):
	s.append(i * (i + 1) // 2)
s = set(s)
for j in s:
	if n - j in s:
		flag = 1
if flag == 0:
	print('NO')
else:
	print('YES')


T_ON = 0
DEBUG_ON = 0
MOD = 998244353

def solve():
	n = read_int()
	A = set()
	k = 1
	while True:
		a = k * (k + 1) // 2
		if a >= n:
			break
		A.add(a)
		k += 1
	for a in A:
		if n - a in A:
			YES()
			return
	NO()

def solve2():
	A = read_ints()
	A.sort()
	(a, b, c) = A
	x = b - a + c - a
	(q, r) = divmod(x, 7)
	debug(a, b, c, x, q, r)
	a -= q
	if r:
		if (6 - r) % 3 != 0:
			NO()
			return
		else:
			a -= (6 - r) // 2 + 1
	if a >= 0 and a % 3 == 0:
		YES()
	else:
		NO()

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def read_int():
	return int(input())

def read_ints():
	return list(map(int, input().split()))

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


n = int(input())
(a, b) = (1, int((2 * (n - 1)) ** 0.5))
(A, B) = (1, b * (b + 1) // 2)
while a <= b:
	if A + B < n:
		a += 1
		A += a
	elif A + B > n:
		B -= b
		b -= 1
	else:
		break
print('NO' if b == 0 or A + B != n else 'YES')


import math
n = int(input())
i = int(math.sqrt(n))
j = i
res = 'NO'
while i > 0 & j < n:
	if i * (i + 1) / 2 + j * (j + 1) / 2 == n:
		res = 'YES'
		break
	elif i * (i + 1) / 2 + j * (j + 1) / 2 < n:
		j += 1
	else:
		i -= 1
print(res)


def funky(x):
	tri = []
	k = 1
	while (k ** 2 + k) / 2 < x:
		tri.append(int((k ** 2 + k) // 2))
		k = k + 1
	return tri

def cool(arr, x):
	m = len(arr)
	l = 0
	r = m - 1
	while r >= l:
		if arr[l] + arr[r] - x == 0:
			return 'YES'
		elif arr[l] + arr[r] > x:
			r = r - 1
		else:
			l = l + 1
	return 'NO'
n = int(input())
arr = funky(n)
print(cool(arr, n))


from math import sqrt

def find(k, n):
	l = 1
	r = n
	while l <= r:
		m = l + (r - l) // 2
		a = k ** 2
		b = m ** 2
		if a + b + m + k == 2 * n:
			return True
		elif a + b + m + k < 2 * n:
			l = m + 1
		else:
			r = m - 1
	return False

def main():
	for _ in range(1):
		n = int(input())
		flag = False
		for k in range(1, int(sqrt(10 ** 9)) + 1):
			if find(k, n):
				flag = True
				break
		print('YES' if flag else 'NO')
main()


def funk(a):
	return int(a * (a + 1) // 2)
from math import sqrt
n = int(input())
true = 0
for i in range(1, int(sqrt(n)) + 2):
	x = funk(i)
	y = n - x
	if y > 0 and funk(int(sqrt(int(2 * y)))) == y:
		print('YES')
		true = 1
		break
if true == 0:
	print('NO')


from math import sqrt
n = int(input())
i = int(sqrt(n))
j = i
p = 'NO'
while i > 0 and j < n:
	s = i * (i + 1) / 2 + j * (j + 1) / 2
	if s == n:
		p = 'YES'
		break
	if s < n:
		j = j + 1
	if s > n:
		i = i - 1
print(p)


import math
num = int(input())

def check(n):
	if n == 0:
		return False
	x = 1 + 8 * n
	sq = math.sqrt(x)
	qwe = int(sq)
	if qwe * qwe == x:
		return True
	return False
flag = 0
for i in range(1, num // 2 + 1):
	i = i * (i + 1) // 2
	if num - i < 0:
		break
	if check(num - i):
		flag = -1
		print('YES')
		break
if flag == 0:
	print('NO')


import math
n = int(input())
s = (2 * n) ** 0.5
x = math.ceil(s)
i = 1
j = x
c = 0
while i <= j:
	if j * (j + 1) // 2 + i * (i + 1) // 2 > n:
		j -= 1
	elif j * (j + 1) // 2 + i * (i + 1) // 2 < n:
		i += 1
	elif j * (j + 1) // 2 + i * (i + 1) // 2 == n:
		print('YES')
		c += 1
		break
if c == 0:
	print('NO')


from sys import stdin
num = int(stdin.readline().strip())
(t, i) = ([0], 1)
while t[i - 1] < num:
	t.append(t[-1] + i)
	i += 1
(i, found) = (1, False)
while not found and t[i] << 1 <= num:
	(target, low, hi) = (num - t[i], i, len(t))
	while not found and low + 1 != hi:
		mid = low + (hi - low >> 1)
		if t[mid] == target:
			found = True
		elif t[mid] > target:
			hi = mid
		else:
			low = mid
	found = found or t[low] == target
	i += 1
if found:
	print('YES')
else:
	print('NO')


import sys, os.path
from collections import *
from copy import *
import math
mod = 10 ** 9 + 7
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def bs(left, right, x):
	while left <= right:
		mid = left + (right - left) // 2
		b = mid * (mid + 1) // 2
		if b == x:
			return 1
		elif b > x:
			right = mid - 1
		else:
			left = mid + 1
	return 0
n = int(input())
n1 = 10 ** 5
flag = 0
for i in range(1, n1 + 1):
	a = i * (i + 1) // 2
	if bs(1, n1, n - a):
		flag = 1
		break
if flag == 0:
	print('NO')
else:
	print('YES')


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
I = lambda : list(map(int, input().split()))
a = set()
for i in range(1, 100000):
	a.add(i * (i + 1) // 2)
(n,) = I()
for i in a:
	if n - i in a:
		print('YES')
		exit()
print('NO')


hash_set = {k * (k + 1) // 2 for k in range(1, 10 ** 5)}
n = int(input())
print('YES' if any((n - t in hash_set for t in hash_set)) else 'NO')


def funky(n):
	arr = [i * (i + 1) / 2 for i in range(1, 2 * int(n ** 0.5) + 1)]
	i = 0
	j = len(arr) - 1
	while i <= j:
		s = arr[i] + arr[j]
		if s == n:
			return True
		elif s < n:
			i += 1
		else:
			j -= 1
	return False
n = int(input())
ans = funky(n)
print('YES' if ans else 'NO')


ar = []
n = int(input())
i = 1
while True:
	x = i * (i + 1) // 2
	if x >= n:
		break
	ar.append(x)
	i += 1
m = 0
for i in ar:
	if n - i in ar:
		m += 1
		break
if m > 0:
	print('YES')
else:
	print('NO')


n = int(input())
s = set()
for i in range(n):
	t = i * (i + 1) // 2
	if t < n:
		s.add(t)
		if n - t in s:
			print('YES')
			exit()
	else:
		break
print('NO')


from sys import *
n = 5 * 10 ** 4 + 1
a = [1] * n
for i in range(1, n):
	a[i] = a[i - 1] + i + 1

def solve(x):
	i = 0
	j = n - 1
	while i <= j:
		if a[i] + a[j] < x:
			i += 1
		elif a[i] + a[j] > x:
			j -= 1
		else:
			return True
	return False
	pass
test = 1
for t in range(0, test):
	x = int(input())
	ans = solve(x)
	if ans:
		print('YES')
	else:
		print('NO')


def funky(n):
	arr = []
	i = 1
	while i * (i + 1) / 2 <= n:
		arr.append(i * (i + 1) / 2)
		i += 1
	ans = 'NO'
	i = 0
	j = len(arr) - 1
	while i <= j:
		value = arr[i] + arr[j]
		if value == n:
			return 'YES'
		elif value < n:
			i += 1
			continue
		else:
			j -= 1
			continue
	return ans
print(funky(int(input())))


a = int(input())
s = set()
for i in range(1, 50000):
	s.add(i * (i + 1) // 2)
ss = list(s)
aa = 0
for i in ss:
	if a - i in s:
		aa = 1
		break
print(['NO', 'YES'][aa])


n = int(input())
top = int(((8 * n - 7) ** 0.5 - 1) / 2) + 1
flag = False
for m1 in range(1, top):
	m2 = int(((8 * n + 2 - (2 * m1 + 1) ** 2) ** 0.5 - 1) / 2)
	if (2 * m1 + 1) ** 2 + (2 * m2 + 1) ** 2 == 8 * n + 2:
		flag = True
		break
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
dic = {}
check = 0
for i in range(1, 10 ** 5):
	dic[i * (i + 1) / 2] = 1
for i in range(1, 10 ** 5):
	if n - i * (i + 1) / 2 in dic:
		check = 1
		break
if check:
	print('YES')
else:
	print('NO')


import math
n = int(input())
y = 1
for i in range(1, int(math.sqrt(2 * n)) + 1):
	if 2 * n - i ** 2 - i > 0:
		if int(math.sqrt(2 * n - i ** 2 - i)) * int(math.sqrt(2 * n - i ** 2 - i) + 1) == 2 * n - i ** 2 - i:
			print('Yes')
			y = 0
			break
if y:
	print('NO')


n = int(input())
d = {}
t = 0
for i in range(1, 10 ** 5):
	d[i * (i + 1) / 2] = 1
for i in range(1, 10 ** 5):
	if n - i * (i + 1) / 2 in d:
		t = 1
		break
if t:
	print('YES')
else:
	print('NO')


def funk(n):
	k = int((2 * n) ** 0.5)
	for j in range(1, k):
		num1 = j * (j + 1) // 2
		tmp = n - num1
		d = 1 + 8 * tmp
		if d < 0:
			continue
		poss = (d ** 0.5 - 1) / 2
		if poss.is_integer():
			return 'YES'
	return 'NO'
n = int(input())
print(funk(n))


def binary_search(arr, start, end, x):
	if end < start:
		return -1
	else:
		mid = start + (end - start) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binary_search(arr, start, mid - 1, x)
		else:
			return binary_search(arr, mid + 1, end, x)
n = int(input())
(total, num, c1, c2, mem) = (n * 2, 2, 2, 3, [2])
while c1 * c2 < total:
	mem.append(c1 * c2)
	c1 += 1
	c2 += 1
for i in mem:
	if binary_search(mem, 0, len(mem) - 1, total - i) != -1:
		exit(print('YES'))
print('NO')


from math import *
n = int(input())
count = 0
for i in range(1, int(n / 2) + 1):
	a = i * (i + 1) / 2
	b = str(a)
	if b[-1] == '0':
		x = n - int(a)
		if x < 0:
			break
		square_root = sqrt(8 * x + 1)
		square_root1 = str(square_root)
		if square_root1[-1] == '0':
			c = (square_root - 1) / 2
			if c == 0.0:
				continue
			else:
				c = str(c)
				if c[-1] == '0':
					print('YES')
					count = 1
					break
if count == 0:
	print('NO')


import bisect
l = [0] * 50001
for i in range(50001):
	if i == 0 or i == 1:
		l[i] = i
	else:
		l[i] = l[i - 1] + i
n = int(input())
i = bisect.bisect_left(l, n)
j = 1
f = 0
while i >= j:
	if l[i] + l[j] == n:
		f = 1
		break
	elif l[i] + l[j] > n:
		i = i - 1
	elif l[i] + l[j] < n:
		j = j + 1
if f == 1 or n == 2:
	print('YES')
else:
	print('NO')


import math
n = int(input())
k = int(math.sqrt(2 * n))
check = False
for i in range(k, 0, -1):
	p = n - i * (i + 1) // 2
	if p <= 0:
		continue
	sqrt_p = int(math.sqrt(2 * p))
	if sqrt_p * (sqrt_p + 1) // 2 == p:
		check = True
		break
if check:
	print('YES')
else:
	print('NO')


def binarySearch(arr, l, r, x):
	if r >= l:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binarySearch(arr, l, mid - 1, x)
		else:
			return binarySearch(arr, mid + 1, r, x)
	else:
		return -1

def checkTriangularSumRepresentation(n):
	tri = list()
	i = 1
	while 1:
		x = i * (i + 1) // 2
		if x >= n:
			break
		tri.append(x)
		i += 1
	for tm in tri:
		a = n - tm
		if binarySearch(tri, 0, len(tri) - 1, a) != -1:
			return True
	return False
n = int(input())
if checkTriangularSumRepresentation(n):
	print('YES')
else:
	print('NO')


from sys import stdin
t = [x * (x + 1) // 2 for x in range(44730)]
num = int(stdin.readline().strip())
(i, found) = (1, False)
for y in range(len(t)):
	if 2 * t[y] == num:
		found = True
while found == False and t[i] < num:
	target = num - t[i]
	(low, hi) = (i, 44730)
	while found == False and low + 1 < hi:
		mid = low + (hi - low) // 2
		if t[mid] == target:
			found = True
		elif t[mid] < target:
			low = mid
		else:
			hi = mid
	i += 1
if found:
	print('YES')
else:
	print('NO')


import math

def isTriangle(n):
	a = math.sqrt(2 * n)
	b = math.floor(a)
	if b * (b + 1) == 2 * n:
		return True
	else:
		return False

def Triangle(m):
	return m * (m + 1) // 2
N = int(input())
t = 0
for i in range(1, int(math.sqrt(N)) + 1):
	a = Triangle(i)
	b = N - a
	if b > 0 and isTriangle(b):
		print('YES')
		t = 1
		break
if t == 0:
	print('NO')


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
import itertools

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def common(l1, l2):
	return set(l1).intersection(l2)

def solution():
	n = Int()
	t = []
	p = []
	i = 1
	while 1:
		a = i * (i + 1) // 2
		if a >= n:
			break
		t.append(a)
		i += 1
	for i in range(len(t)):
		p.append(n - t[i])
	ans = common(t, p)
	if len(ans) > 0:
		print('YES')
	else:
		print('NO')
solution()


n = int(input())
n = n * 2
k = 0
f = False
for i in range(1, int(n ** 0.5)):
	n1 = n - i * (i + 1)
	k = int(n1 ** 0.5)
	if k * (k + 1) == n1 and k != 0:
		print('YES')
		f = True
		break
if f == False:
	print('NO')


n = int(input())
output = 'NO'
for k in range(1, 100001):
	val = k * k + k
	val /= 2
	c = n - val
	val = 1 + 8 * c
	if val <= 0:
		continue
	if int(pow(val, 0.5)) ** 2 == val and val > 1:
		output = 'YES'
		break
print(output)


from math import sqrt
n = int(input())
status = 'NO'
a = sqrt(n)
(i, j) = (int(a), int(a))
while i >= 1 and j <= n:
	sum = i * (i + 1) / 2 + j * (j + 1) / 2
	if sum == n:
		status = 'YES'
		break
	if sum > n:
		i = i - 1
	if sum < n:
		j = j + 1
print(status)


from collections import defaultdict, OrderedDict, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import Queue, PriorityQueue
from heapq import *
from statistics import *
from math import sqrt, log10, log2, log, gcd, ceil, floor
import fractions
import copy
from copy import deepcopy
import sys
import io
sys.setrecursionlimit(10000)
import math
import os
import bisect
import collections
mod = int(pow(10, 9)) + 7
import random
from random import *
from time import time
import itertools
from itertools import combinations, permutations, combinations_with_replacement, product

def ncr(n, r, p=mod):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def normalncr(n, r):
	r = min(r, n - r)
	count = 1
	for i in range(n - r, n + 1):
		count *= i
	for i in range(1, r + 1):
		count //= i
	return count
inf = float('inf')
adj = defaultdict(set)
visited = defaultdict(int)

def addedge(a, b):
	adj[a].add(b)
	adj[b].add(a)

def bfs(v):
	q = Queue()
	q.put(v)
	visited[v] = 1
	while q.qsize() > 0:
		s = q.get_nowait()
		print(s)
		for i in adj[s]:
			if visited[i] == 0:
				q.put(i)
				visited[i] = 1

def dfs(v, visited):
	if visited[v] == 1:
		return
	visited[v] = 1
	print(v)
	for i in adj[v]:
		dfs(i, visited)

def reverse_bisect_right(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x > a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

def reverse_bisect_left(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x >= a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

def get_list():
	return list(map(int, input().split()))

def make_list(m):
	m += list(map(int, input().split()))

def get_str_list_in_int():
	return [int(i) for i in list(input())]

def get_str_list():
	return list(input())

def get_map():
	return map(int, input().split())

def input_int():
	return int(input())

def matrix(a, b):
	return [[0 for i in range(b)] for j in range(a)]

def swap(a, b):
	return (b, a)

def find_gcd(l):
	a = l[0]
	for i in range(len(l)):
		a = gcd(a, l[i])
	return a

def is_prime(n):
	sqrta = int(sqrt(n))
	for i in range(2, sqrta + 1):
		if n % i == 0:
			return 0
	return 1

def prime_factors(n):
	while n % 2 == 0:
		return [2] + prime_factors(n // 2)
	sqrta = int(sqrt(n))
	for i in range(3, sqrta + 1, 2):
		if n % i == 0:
			return [i] + prime_factors(n // i)
	return [n]

def p(a):
	if type(a) == str:
		print(a + '\n')
	else:
		print(str(a) + '\n')

def ps(a):
	if type(a) == str:
		print(a)
	else:
		print(str(a))

def kth_no_not_div_by_n(n, k):
	return k + (k - 1) // (n - 1)

def forward_array(l):
	n = len(l)
	stack = []
	forward = [0] * n
	for i in range(len(l) - 1, -1, -1):
		while len(stack) and l[stack[-1]] < l[i]:
			stack.pop()
		if len(stack) == 0:
			forward[i] = len(l)
		else:
			forward[i] = stack[-1]
		stack.append(i)
	return forward

def backward_array(l):
	n = len(l)
	stack = []
	backward = [0] * n
	for i in range(len(l)):
		while len(stack) and l[stack[-1]] < l[i]:
			stack.pop()
		if len(stack) == 0:
			backward[i] = -1
		else:
			backward[i] = stack[-1]
		stack.append(i)
	return backward

def char(a):
	return chr(a + 97)

def get_length(a):
	return 1 + int(log10(a))

def issq(n):
	sqrta = int(n ** 0.5)
	return sqrta ** 2 == n

def ceil(a, b):
	return int((a + b - 1) / b)

def equal_sum_partition(arr, n):
	sum = 0
	for i in range(n):
		sum += arr[i]
	if sum % 2 != 0:
		return False
	part = [[True for i in range(n + 1)] for j in range(sum // 2 + 1)]
	for i in range(0, n + 1):
		part[0][i] = True
	for i in range(1, sum // 2 + 1):
		part[i][0] = False
	for i in range(1, sum // 2 + 1):
		for j in range(1, n + 1):
			part[i][j] = part[i][j - 1]
			if i >= arr[j - 1]:
				part[i][j] = part[i][j] or part[i - arr[j - 1]][j - 1]
	return part[sum // 2][n]

def bin_sum_array(arr, n):
	for i in range(n):
		if arr[i] % 2 == 1:
			return i + 1
	binarray = [list(reversed(bin(i)[2:])) for i in arr]
	new_array = [0 for i in range(32)]
	for i in binarray:
		for j in range(len(i)):
			if i[j] == '1':
				new_array[j] += 1
	return new_array
nc = 'NO'
yc = 'YES'
ns = 'No'
ys = 'Yes'

def yesno(a):
	print(yc if a else nc)

def reduce(dict, a):
	dict[a] -= 1
	if dict[a] == 0:
		dict.pop(a)
arr = [i * (i + 1) // 2 for i in range(1, 100000) if i * (i + 1) // 2 < 10 ** 9]
no = 10 ** 9
for i in range(1):
	n = int(input())
	for i in arr:
		index = bisect_left(arr, n - i)
		if index != len(arr) and arr[index] == n - i:
			print(yc)
			break
	else:
		print(nc)


import math
n = int(input())
v = math.floor((-1 + math.sqrt(1 + 8 * n)) / 2)
for i in range(v, 0, -1):
	z = n - i * (i + 1) / 2
	a = (-1 + math.sqrt(1 + 8 * z)) / 2
	if a.is_integer() and a > 0:
		print('YES')
		exit(0)
print('NO')


n = int(input())
if n == 1:
	print('NO')
else:
	a = [1]
	b = 1
	while a[-1] < n:
		b += 1
		a.append(int(b * (b + 1) / 2))
	a = a[:-1]
	r = b - 2
	l = 0
	while r != l and a[l] + a[r] != n:
		if a[l] + a[r] > n:
			r -= 1
		else:
			l += 1
	if a[l] + a[r] == n:
		print('YES')
	else:
		print('NO')


import math

def fun(n):
	return n * (n + 1) / 2
n = int(input())
j = int(pow(n * 2, 0.5))
arr = [fun(i) for i in range(j + 1)]
i = 1
while i <= j:
	a = arr[j] + arr[i]
	if a == n:
		print('YES')
		break
	elif a < n:
		i += 1
	elif a > n:
		j -= 1
else:
	print('NO')


a = set([i * (i + 1) / 2 for i in range(1, 50000)])
n = int(input())
print(['NO', 'YES'][any((n - t in a for t in a))])


def binary(l, n):
	(low, high) = (0, len(l))
	while low <= high:
		mid = (low + high) // 2
		if l[mid] == n:
			return True
		elif l[mid] > n:
			high = mid - 1
		else:
			low = mid + 1
	return False
l = list()
for i in range(1, 50000):
	l.append(i * (i + 1) // 2)
n = int(input())
i = 0
result = False
while l[i] <= n:
	if binary(l, n - l[i]):
		result = True
		break
	i += 1
if result:
	print('YES')
else:
	print('NO')


l = set([i * (i + 1) // 2 for i in range(1, 100001)])
n = int(input())
a = False
for i in l:
	if n - i in l:
		a = True
		break
if a is True:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	lookup = set()
	k = 1
	while k * (k + 1) // 2 <= n:
		lookup.add(k * (k + 1) // 2)
		k += 1
	ok = False
	for elm in lookup:
		if elm < n:
			if n - elm in lookup:
				ok = True
	if ok:
		print('YES')
	else:
		print('NO')
main()


import math

def sum_of_triangular(x):
	f = math.sqrt(1 + 8 * x)
	g = (f - 1) / 2
	h = math.ceil(g)
	if True:
		for i in range(1, h):
			c = 1 - 4 * (i * i + i - 2 * x)
			d = math.sqrt(c)
			e = d - math.floor(d)
			if e == 0 and (d - 1) % 2 == 0:
				return print('Yes')
				break
			else:
				pass
	print('NO')
a = int(input())
sum_of_triangular(a)


def search(n, arr):
	(start, end) = (0, l - 1)
	while start <= end:
		mid = (start + end) // 2
		if arr[mid] == n:
			return True
		elif n <= arr[mid]:
			end = mid - 1
		else:
			start = mid + 1
	return False
n = int(input())
funky = []
i = 1
while True:
	num = i * (i + 1) // 2
	if num <= n:
		funky.append(num)
	else:
		break
	i += 1
l = len(funky)
(i, flag) = (1, False)
while i * i <= n:
	complement = n - i * (i + 1) // 2
	if search(complement, funky):
		flag = True
		break
	i += 1
print('YES' if flag else 'NO')


def main():
	from bisect import bisect_left
	n = int(input()) * 2
	l = [i * (i + 1) for i in range(1, int(n ** 0.5) + 2)]
	for a in l:
		b = l[bisect_left(l, n - a)]
		if b <= a or a + b == n:
			break
	print(('NO', 'YES')[a + b == n])
main()


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def gcd(a, b):
	while b:
		a = a % b
		(b, a) = (a, b)
	return a

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
		a *= a
		n = n >> 1
	return r

def solve():
	n = inp()
	c = 0
	i = 1
	while i * i <= n:
		a = i * (i + 1) // 2
		b = n - a
		x = (-1 + (1 + 8 * b) ** 0.5) // 2
		y = (-1 - (1 + 8 * b) ** 0.5) // 2
		if type(x) == float and math.floor(x) == x:
			v = math.floor(x)
			if v > 0 and v * (v + 1) // 2 + a == n:
				c = 1
				break
		if type(y) == float and math.floor(y) == y:
			v = math.floor(y)
			if v > 0 and v * (v + 1) // 2 + a == n:
				c = 1
				break
		i += 1
	if c:
		print('YES')
	else:
		print('NO')
for _ in range(1):
	solve()


def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def MAP2():
	return map(float, input().split())

def LIST():
	return list(map(int, input().split()))

def STRING():
	return input()
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter
from math import *
from itertools import permutations
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
x = INT()
d = set()
for i in range(1, 100009):
	j = i * (i + 1) // 2
	d.add(j)
f = 0
for i in d:
	z = x - i
	if z in d:
		f = 1
		break
if f:
	print('YES')
else:
	print('NO')


import bisect
from itertools import accumulate
import os
import sys
import math
from decimal import *
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def SieveOfEratosthenes(n):
	prime = []
	primes = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if primes[p] == True:
			prime.append(p)
			for i in range(p * p, n + 1, p):
				primes[i] = False
		p += 1
	return prime
n = int(input())
ans = []
for i in range(1, 10 ** 6):
	ans.append(i * (i + 1) / 2)
l = 0
r = len(ans) - 1
while l <= r:
	if ans[l] + ans[r] > n:
		r -= 1
	elif ans[l] + ans[r] < n:
		l += 1
	else:
		print('YES')
		exit()
print('NO')


n = int(input())
m = 2 * n + 0.5
l = int(n ** (1 / 2))
flag = 0
for i in range(1, l + 1):
	a = (m - (i + 0.5) ** 2) ** (1 / 2) - 0.5
	if a == int((m - (i + 0.5) ** 2) ** (1 / 2) - 0.5) and a != 0:
		print('Yes')
		flag = 1
		break
	i = i + 1
if flag == 0:
	print('No')


n = int(input())
arr = []
f = 0
for i in range(1, 45000):
	arr.append(i * (i + 1) // 2)
for el in arr:
	if n - el in arr:
		f = 1
		break
if f == 1:
	print('YES')
else:
	print('NO')


r = lambda x: x * (x + 1) // 2
z = [r(i) for i in range(1, 50001)]

def bin_S(x):
	lo = 0
	hi = 50000
	while lo <= hi:
		mid = (lo + hi) // 2
		if z[mid] == x:
			return True
		if z[mid] > x:
			hi = mid - 1
		else:
			lo = mid + 1
	return False

def check(a):
	for i in z:
		if bin_S(a - i):
			return 'YES'
	return 'NO'
print(check(int(input())))


n = int(input())
lst = [i * (i + 1) // 2 for i in range(1, 1 + int((2 * n) ** 0.5))]
high = len(lst) - 1
low = 0
flag = False
if n / 2 in lst:
	flag = True
else:
	while low < high:
		if lst[low] + lst[high] == n:
			flag = True
			break
		elif lst[low] + lst[high] > n:
			high -= 1
		else:
			low += 1
print('YES' if flag else 'NO')


from math import sqrt
p = int(input())
n = 2 * p + 0.5
log = 0
for i in range(1, int(sqrt(n))):
	x = sqrt(n - (i + 0.5) ** 2) - 0.5
	if int(x) == x:
		log = 1
		break
if log == 1:
	print('YES')
if log == 0:
	print('NO')


import math
funk = []
n = int(input())
for i in range(2 * int(math.sqrt(n)) + 1):
	funk.append(i * (i + 1) // 2)
i = 1
j = len(funk) - 1
while j >= i:
	if funk[i] + funk[j] > n:
		j -= 1
	elif funk[i] + funk[j] < n:
		i += 1
	else:
		print('YES')
		exit()
print('NO')


import math
from bisect import bisect_left

def BinarySearch(a, x):
	i = bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	else:
		return -1
n = int(input())
possible_nums = []
i = 1
a = 0
while a <= n:
	a = (math.pow(i, 2) + i) / 2
	if a <= n:
		possible_nums.append(a)
	i += 1
possible = 0
for a in possible_nums:
	diff = n - a
	i = BinarySearch(possible_nums, diff)
	if i >= 0:
		print('YES')
		possible = 1
		break
	else:
		continue
if not possible:
	print('NO')


n = int(input())
n *= 2
for i in range(1, int(n ** 0.5)):
	b = n - i * i - i
	c = (-1 + (1 + 4 * b) ** 0.5) / 2
	if int(c) == c:
		print('YES')
		exit()
print('NO')


from collections import Counter
r = lambda x: x * (x + 1) // 2
z = [r(i) for i in range(1, 50001)]
z = Counter(z)

def check(a):
	for i in z:
		if z[a - i]:
			return 'YES'
	return 'NO'
print(check(int(input())))


n = int(input())
s = set()
i = 1
while i < 100000:
	x = i * (i + 1) // 2
	s.add(x)
	i += 1
for i in s:
	if n - i in s:
		print('YES')
		exit(0)
print('NO')


import math
n = int(input())

def funky(n):
	if n == 1:
		return 'NO'
	else:
		x = int(math.sqrt(n))
		for i in range(1, x + 1):
			y = i * (i + 1) // 2
			k2 = int(math.sqrt((n - y) * 2))
			z = k2 * (k2 + 1) // 2
			if y + z == n:
				return 'YES'
		return 'NO'
print(funky(n))


def Sum(n):
	return n * (n + 1) // 2

def check(n):
	limit = int((2 * n) ** (1 / 2))
	k = limit
	while 0 < k <= limit:
		l = 1
		u = k + 1
		while u != l:
			mid = int((l + u) / 2)
			curr = Sum(mid) + Sum(k)
			if curr == n:
				return 'YES'
			elif curr > n:
				if u == mid:
					break
				u = mid
			else:
				if l == mid:
					break
				l = mid
		k -= 1
	return 'NO'
n = int(input())
print(check(n))


def binarySearch(arr, l, r, x):
	if r >= l:
		mid = int(l + (r - l) / 2)
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binarySearch(arr, l, mid - 1, x)
		else:
			return binarySearch(arr, mid + 1, r, x)
	else:
		return -1

def b():
	number = int(input())
	a = [0]
	if number != 1:
		for i in range(1, 10 ** 5 + 1):
			a.append(a[i - 1] + i)
		for i in range(1, 10 ** 5 + 1):
			if binarySearch(a, 1, len(a) - 1, number - a[i]) != -1:
				print('Yes')
				return
	print('No')
b()


from bisect import bisect_left

def index(a, x):
	i = bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return True
	return -1
c = int(input())
list1 = []
for i in range(50000):
	z = i * (i + 1) // 2
	list1.append(z)
temp = 0
for i in list1:
	z = c - i
	k = index(list1, z)
	if k == True and z != c and (c != i):
		temp = 1
		break
if temp == 0:
	print('NO')
else:
	print('YES')


def binarySearch(arr, l, r, x):
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1
n = int(input())
ll = []
for k in range(1, 47722):
	ll.append(int(k * (k + 1) // 2))
found = False
for k in ll:
	j = n - k
	pos = binarySearch(ll, 0, len(ll) - 1, j)
	if pos >= 0:
		found = True
		break
if found:
	print('YES')
else:
	print('NO')


p = set([i * (i + 1) // 2 for i in range(1, 45000)])
n = int(input())
q = set([n - i for i in p])
t = p & q
if t:
	print('YES')
else:
	print('NO')


def binarySearch(arr, l, r, x):
	if r >= l:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binarySearch(arr, l, mid - 1, x)
		else:
			return binarySearch(arr, mid + 1, r, x)
	else:
		return -1
n = int(input())
i = t = 1
a = []
x = 0
while x < 1000000000:
	x = i * (i + 1)
	x //= 2
	a.append(x)
	i += 1
for i in a:
	x = n - i
	if binarySearch(a, 0, len(a), x) != -1:
		print('YES')
		t = 0
		break
if t == 1:
	print('NO')


n = int(input())
if n == 1:
	print('NO')
elif n == 2:
	print('YES')
elif n == 3:
	print('NO')
elif n == 4:
	print('YES')
else:
	sqrt_n = int(n ** 0.5) // 1
	num = 2 * sqrt_n
	l1 = []
	ismatched = False
	for i in range(1, num + 1):
		val = i * (i + 1) // 2
		val_2 = n - val
		if val_2 >= 0:
			discriminat = (1 + 8 * val_2) ** 0.5
			if int(discriminat) * int(discriminat) == 1 + 8 * val_2:
				val3 = (discriminat - 1) // 2
				if n == 1:
					print('NO')
				elif int(val3 * 2) == discriminat - 1:
					if int(val3) <= num:
						val4 = int(val3)
						if n == i * (i + 1) // 2 + val4 * (val4 + 1) // 2 and val4 != 0:
							print('YES')
							ismatched = True
							break
	if ismatched == False:
		print('NO')


import math
n = int(input())
a = 1
b = 1
c = -(2 * n)
d = b ** 2 - 4 * a * c
flag = 0
sol = (-b + math.sqrt(d)) // (2 * a)
ma = int(sol)
temp = 0
for i in range(1, ma + 1):
	temp += i
	c = -(2 * (n - temp))
	d = b ** 2 - 4 * a * c
	sol = (-b + math.sqrt(d)) // (2 * a)
	if sol * (sol + 1) // 2 + temp == n and sol > 0:
		flag = 1
		print('YES')
		break
if flag == 0:
	print('NO')


n = int(input())
k = set([z * (z + 1) / 2 for z in range(1, 45000)])
f = 0
for j in k:
	if n - j in k:
		f = 1
if f == 1:
	print('YES')
else:
	print('NO')


from sys import *
import math

def funky_number(n):
	i = 1
	j = 2
	test = False
	while i < n:
		y = n - i
		m = int(math.sqrt(2 * y))
		if m * (m + 1) == 2 * y:
			test = True
			break
		else:
			i = i + j
			j = j + 1
	return test
n = int(input())
if funky_number(n) == True:
	print('yes')
else:
	print('no')


def main():
	nums = []
	tr_nums = set()
	for k in range(1, 10 ** 5 + 1):
		num = k * (k + 1) // 2
		nums.append(num)
		tr_nums.add(num)
	n = int(input())
	for i in nums:
		if n - i in tr_nums:
			print('YES')
			return
	print('NO')
main()


n = int(input())
a = set([k * (k + 1) // 2 for k in range(1, int(2 * n ** 0.5))])

def fn(a):
	for i in a:
		if n - i in a:
			return 'YES'
	return 'NO'
print(fn(a))


s = set([i * (i + 1) // 2 for i in range(1, 50000)])
n = int(input())
k = set([n - i for i in s])
p = k.intersection(s)
if len(p) > 0:
	print('YES')
else:
	print('NO')


n = int(input())
fn = []
k = 1
while True:
	num = k * (k + 1) // 2
	if num > n:
		break
	fn.append(num)
	k += 1
i = 0
j = len(fn) - 1
while i <= j:
	if fn[i] + fn[j] == n:
		print('YES')
		break
	elif fn[i] + fn[j] < n:
		i += 1
	else:
		j -= 1
if i > j or fn[i] + fn[j] != n:
	print('NO')


from math import sqrt, ceil

def findnumber(arr, z, lo, hi):
	while hi >= lo:
		mid = lo + (hi - lo) // 2
		if arr[mid] == z:
			return True
		elif z > arr[mid]:
			lo = mid + 1
		else:
			hi = mid - 1
	return False
n = int(input()) * 2
z = ceil(sqrt(n))
arr = [i * (i + 1) for i in range(1, z)]
fnd = False
for i in arr:
	to_find = n - i
	if findnumber(arr, to_find, 0, len(arr) - 1):
		print('YES')
		fnd = True
		break
if not fnd:
	print('NO')


Number = list(map(int, input().split()))

def binarySearch(arr, l, r, x):
	if r >= l:
		mid = int(l + (r - l) / 2)
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binarySearch(arr, l, mid - 1, x)
		else:
			return binarySearch(arr, mid + 1, r, x)
	else:
		return -1

def getNums(n):
	triangleNumbers = list()
	i = 1
	while True:
		x = i * (i + 1) / 2
		if x >= n:
			break
		triangleNumbers.append(x)
		i += 1
	return triangleNumbers
tNums = getNums(Number[0])
noWay = True
for a in tNums:
	if binarySearch(tNums, 0, len(tNums) - 1, Number[0] - a) != -1:
		print('YES')
		noWay = False
		break
if noWay:
	print('NO')


import bisect

def binarySearch3(lst, x):
	i = bisect.bisect_left(lst, x)
	if i != len(lst) and lst[i] == x:
		return i
	return -1
n = int(input())
a = [i * (i + 1) // 2 for i in range(1, 1000000)]
for i in a:
	if binarySearch3(a, n - i) != -1:
		print('YES')
		exit(0)
	if n - i < 0:
		break
print('NO')


from collections import defaultdict
n = int(input())
a = 1
b = 2
d = defaultdict(int)
d[a] += 1
while a < 10 ** 9 and a < n:
	if d[n - a] == 1:
		print('YES')
		break
	a = a + b
	b += 1
	d[a] += 1
else:
	print('NO')


n = int(input())
posi = int(n ** 0.5)
if posi * (posi + 1) == n:
	print('YES')
else:
	value = n * 2
	(i, j) = (posi, posi)
	k = int(value ** 0.5)
	while i >= 1 and j <= k:
		summ = i * (i + 1) + j * (j + 1)
		if summ == value:
			break
		elif summ > value:
			i -= 1
		else:
			j += 1
	if summ == value:
		print('YES')
	else:
		print('NO')


def f(a):
	return a * (a + 1) / 2
n = int(input())
s = set()
i = 1
while f(i) <= 1000000000:
	s.add(f(i))
	i = i + 1
find = False
for el in s:
	if n - el in s:
		find = True
		print('YES')
		break
if not find:
	print('NO')


def R():
	return map(int, input().split())

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
import bisect
mod = 10 ** 9 + 7

def check(x):
	y = int(math.sqrt(8 * x + 1))
	return y * y == 8 * x + 1
n = I()
for k in range(1, int(math.sqrt(2 * n)) + 10):
	if k * (k + 1) // 2 <= n and n - k * (k + 1) // 2 > 0 and check(n - k * (k + 1) // 2):
		print('YES')
		exit()
print('NO')


from math import sqrt

def binary_search(s, e, target):
	if s > e:
		return False
	mid = s + (e - s) // 2
	mid_squared = pow(mid, 2)
	if mid_squared == target:
		return True
	elif mid_squared > target:
		return binary_search(s, mid - 1, target)
	else:
		return binary_search(mid + 1, e, target)

def funky_numbers(n_int) -> str:
	odd_1 = 3
	odd_1_squared = pow(odd_1, 2)
	while odd_1_squared <= n_int:
		a_squared = n_int - odd_1_squared
		start = 3
		end = int(sqrt(a_squared) + 1)
		if binary_search(start, end, a_squared):
			return 'YES'
		else:
			odd_1 += 2
			odd_1_squared = pow(odd_1, 2)
	return 'NO'
n = int(input())
print(funky_numbers(8 * n + 2))


def check_number(arr, no):
	i = 0
	j = len(arr) - 1
	while i <= j:
		if arr[i] + arr[j] == no:
			return 'YES'
		elif arr[i] + arr[j] > no:
			j -= 1
		else:
			i += 1
	return 'NO'

def check_funky(n):
	i = 1
	arr = []
	while i * (i + 1) // 2 <= 10 ** 9:
		arr.append(i * (i + 1) // 2)
		i += 1
	return check_number(arr, n)
n = int(input())
print(check_funky(n))


import math
n = int(input())
upperBound = int(math.sqrt(2 * n))
funky = []
for i in range(upperBound + 1):
	temp = int(i * (i + 1) / 2)
	funky.append(temp)
flag = False
lower_index = 1
upper_index = upperBound
while lower_index <= upper_index:
	temp = funky[lower_index] + funky[upper_index]
	if temp == n:
		flag = True
		break
	elif temp < n:
		lower_index += 1
	elif temp > n:
		upper_index -= 1
print('YES') if flag else print('NO')


import math
a = int(input()) * 2
b = 0
for i in range(1, int(math.sqrt(a))):
	c = a - i * i - i
	d = int(math.sqrt(c))
	if d * (d + 1) == c:
		b = 1
print('YES') if b else print('NO')


import math
n = int(input())
for i in range(1, n):
	z = i * (i + 1)
	if z > n:
		break
	t = int(math.sqrt(2 * n - z))
	t = t * (t + 1)
	if t == 2 * n - z:
		print('YES')
		quit()
print('NO')


def binarysearch(ar, l, r, x):
	if r >= l:
		mid = l + (r - l) // 2
		if ar[mid] == x:
			return mid
		elif ar[mid] < x:
			return binarysearch(ar, mid + 1, r, x)
		else:
			return binarysearch(ar, l, mid - 1, x)
	return -1

def funky(n):
	a = int((2 * n) ** 0.5) + int(2)
	ar = []
	for i in range(1, a):
		k = int(i * (i + 1) / 2)
		ar.append(k)
	return ar

def CoolestNum(ar, l, r, x):
	b = binarysearch(ar, l, r, x / 2)
	if b != -1:
		return 'YES'
	else:
		g = len(ar)
		for i in range(g - 1, -1, -1):
			if ar[i] > x // 2:
				diff = x - ar[i]
				term = binarysearch(ar, 0, g - 1, diff)
				if term != -1:
					return 'YES'
	return 'NO'
n = int(input())
ar = funky(n)
q = len(ar)
print(CoolestNum(ar, 0, q - 1, n))


n = int(input())
i = 0
init = 0
listd = set()
while i < n:
	init += 1
	i = init + i
	listd.add(i)
for i in listd:
	if n - i in listd:
		print('YES')
		init = 0
		break
if init != 0:
	print('NO')


import math

def give_tri(a):
	return a * (a + 1) / 2

def check_tri(a3):
	p = int(math.sqrt(2 * a3))
	if a3 == 0:
		return False
	elif p * (p + 1) == 2 * a3:
		return True
	else:
		return False

def check_cool(a1):
	j = int(a1 ** 0.5)
	while j >= 1:
		k1 = a1 - give_tri(j)
		if check_tri(k1):
			return 'YES'
		else:
			j = j - 1
	return 'NO'
num = int(input())
print(check_cool(num))


z = int(input())
d = {}
i = 1
while i * (i + 1) / 2 < z:
	if d.get(i * (i + 1) / 2, 0) == 0:
		d[i * (i + 1) / 2] = 1
	i += 1
c = 1
while c * (c + 1) / 2 < z:
	g = z - c * (c + 1) / 2
	if d.get(g, 0) != 0 and d[g] == 1:
		print('YES')
		exit()
	c += 1
print('NO')


n = int(input())
k = []
for i in range(1, 10 ** 5):
	k.append(i * (i + 1) // 2)
c = 0
s = set(k)
for j in s:
	if n - j in s:
		c = 1
		break
print('YES') if c == 1 else print('NO')


n = int(input())
if n == 1:
	print('NO')
else:
	triangular_numbers = []
	for k in range(1, 100000):
		triangular_numbers.append(int(k * (k + 1) / 2))
	last_limit = None
	high = len(triangular_numbers) - 1
	low = 0
	while True:
		mid = int((high + low) / 2)
		if high - low < 10:
			last_limit = high
			break
		elif n < triangular_numbers[mid]:
			high = mid - 1
		elif n > triangular_numbers[mid]:
			low = mid + 1
		else:
			last_limit = triangular_numbers[mid]
			break
	last_index = last_limit
	found = False
	for a in triangular_numbers[:last_index + 1]:
		b = n - a
		try:
			found = int((2 * b + 0.25) ** 0.5 - 0.5) == (2 * b + 0.25) ** 0.5 - 0.5 and int((2 * b + 0.25) ** 0.5 - 0.5) > 0
		except:
			found = False
			break
		if found:
			print('YES')
			break
	if not found:
		print('NO')


from sys import *

def check1(arr, n):
	i = 0
	j = len(arr) - 1
	while i <= j:
		if arr[i] + arr[j] == n:
			return 'YES'
		elif arr[i] + arr[j] > n:
			j -= 1
		else:
			i += 1
	return 'NO'

def check2(n):
	i = 1
	arr = []
	while i * (i + 1) / 2 <= 10 ** 9:
		arr.append(i * (i + 1) / 2)
		i += 1
	return check1(arr, n)
n = int(input())
print(check2(n))


from sys import stdin, stdout
n = int(stdin.readline())
label = 0
first = 1
while first * (first + 1) // 2 < n:
	cnt = n - first * (first + 1) // 2
	l = 0
	r = cnt + 10
	while r - l > 1:
		m = (r + l) // 2
		if m * (m + 1) // 2 > cnt:
			r = m
		else:
			l = m
	if l * (l + 1) // 2 == cnt:
		label = 1
		break
	first += 1
if label:
	stdout.write('YES')
else:
	stdout.write('NO')


d1 = {}
for i in range(1, 10 * int((10 ** 9) ** 0.5)):
	d1[i * (i + 1) // 2] = 1
n = int(input())
import sys
for k in d1:
	if n - k in d1:
		print('YES')
		sys.exit()
print('NO')


import math

def b_search(l, r, arr, x):
	while l <= r:
		mid = (l + r) // 2
		if x < arr[mid]:
			r = mid - 1
		elif x > arr[mid]:
			l = mid + 1
		elif x == arr[mid]:
			return True
	return False
n = int(input())
N = math.sqrt(2 * n)
arr = []
arr.append(0)
for i in range(1, int(N) + 1):
	arr.append(arr[i - 1] + i)
flag = 1
for i in range(1, int(N)):
	if b_search(0, int(N), arr, n - arr[i]):
		print('YES')
		flag = 0
		break
if flag:
	print('NO')


n = int(input())
a = set()
for i in range(n):
	x = i * (i + 1) // 2
	if x >= n:
		print('NO')
		break
	a.add(x)
	if n - x in a:
		print('YES')
		break
else:
	print('NO')


from math import sqrt
n = int(input())
first = 0
k1 = 1
while first < n / 2:
	first = int(k1 * (k1 + 1) / 2)
	k1 += 1
	m = n - first
	if m > 0 and (int(sqrt(8 * m + 1)) ** 2 == 8 * m + 1 or (int(sqrt(8 * m + 1)) + 1) ** 2 == 8 * m + 1):
		print('YES')
		break
else:
	print('NO')


import math
n = int(input())
t = math.sqrt(n)
if n == 1:
	print('NO')
	exit(0)
else:
	for i in range(1, int(t) + 1):
		q = n - i * (i + 1) / 2
		q1 = 1 + 8 * q
		q2 = math.sqrt(q1)
		q3 = int(q2)
		if q3 * q3 == q1:
			print('YES')
			exit(0)
print('NO')


from bisect import bisect_left

def BinarySearch(a, x):
	i = bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	else:
		return -1
num = int(input())
nums = []
for n in range(1, num):
	nt = n * (n + 1) // 2
	if nt < num:
		nums.append(nt)
	elif nt >= num:
		break
passe = False
for n in nums:
	if BinarySearch(nums, num - n) != -1:
		passe = True
if passe:
	print('YES')
else:
	print('NO')


import math
n = int(input())
l = 1
u = round(math.sqrt(n)) * 2
f = False
while l <= u:
	if l * (l + 1) + u * (u + 1) < 2 * n:
		l += 1
	elif l * (l + 1) + u * (u + 1) > 2 * n:
		u -= 1
	else:
		f = True
		break
if f:
	print('YES')
else:
	print('NO')


import math

def checkTriangular(n):
	odd = 1 + 8 * n
	oddsqrt = math.sqrt(odd)
	return oddsqrt == int(oddsqrt)
num = int(input())
bool = False
diff = 1
i = 1
while i <= num // 2:
	if checkTriangular(i) and checkTriangular(num - i):
		bool = True
		print('YES')
		break
	diff += 1
	i += diff
if bool == False:
	print('NO')


import sys
import math
from heapq import *
input = sys.stdin.readline
from functools import cmp_to_key

def pi():
	return int(input())

def pl():
	return int(input(), 16)

def ti():
	return list(map(int, input().split()))

def ts():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
mod = 1000000007
f = []

def fact(n, m):
	global f
	f = [1 for i in range(n + 1)]
	f[0] = 1
	for i in range(1, n + 1):
		f[i] = f[i - 1] * i % m

def fast_mod_exp(a, b, m):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b = b >> 1
	return res

def inverseMod(n, m):
	return fast_mod_exp(n, m - 2, m)

def ncr(n, r, m):
	if n < 0 or r < 0 or r > n:
		return 0
	if r == 0:
		return 1
	return f[n] * inverseMod(f[n - r], m) % m * inverseMod(f[r], m) % m

def main():
	A()

def A():
	n = pi()
	i = 1
	ans = 0
	while i * (i + 1) <= n:
		j = math.floor(math.sqrt(2 * n - i * (i + 1)))
		if i * (i + 1) + j * (j + 1) == 2 * n:
			ans = 1
			break
		i += 1
	if ans:
		print('YES')
	else:
		print('NO')
main()


n = int(input())
k = 1
arr = []
while k * (k + 1) // 2 <= n:
	arr.append(k * (k + 1) // 2)
	k += 1
start = 0
end = len(arr) - 1
flag = 0
while start <= end:
	k = arr[start] + arr[end]
	if k < n:
		start += 1
		continue
	if k > n:
		end -= 1
		continue
	else:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


from math import sqrt

def fun(n):
	s = set([k * (k + 1) // 2 for k in range(1, int(2 * sqrt(n)))])
	for elem in s:
		if n - elem in s:
			return 'YES'
	return 'NO'
print(fun(int(input())))


n = int(input())
i = 1
mop = {}
while i < 100001:
	mop[i * (i + 1) / 2] = 1
	i += 1
for i in mop:
	if n - i in mop:
		print('YES')
		exit()
print('NO')


def give_tri(a2):
	return a2 * (a2 + 1) / 2

def check_tri(a3):
	p = int((2 * a3) ** 0.5)
	if a3 == 0:
		return False
	elif p * (p + 1) == 2 * a3:
		return True
	else:
		return False

def check_cool(a1):
	j = int(a1 ** 0.5)
	while j >= 1:
		k1 = a1 - give_tri(j)
		if check_tri(k1):
			return True
		else:
			j = j - 1
n = int(input())
if check_cool(n):
	print('YES')
else:
	print('NO')


import math
n = int(input())
n = 2 * n
up = int(math.sqrt(n))
n = n / 2
arr = [0] * (up + 1)
for i in range(0, up + 1):
	arr[i] = int(i * (i + 1) / 2)
flag = 0
lo = 1
while lo <= up:
	if arr[lo] + arr[up] == n:
		flag = 1
		break
	elif arr[lo] + arr[up] < n:
		lo = lo + 1
	elif arr[lo] + arr[up] > n:
		up = up - 1
if flag == 1:
	print('YES')
else:
	print('NO')


def binary_search(arr, low, high, x):
	if high >= low:
		mid = (high + low) // 2
		if arr[mid] == x:
			return 1
		elif arr[mid] > x:
			return binary_search(arr, low, mid - 1, x)
		else:
			return binary_search(arr, mid + 1, high, x)
	else:
		return 0
import math
n = int(input())
n = n * (1 + 1)
t = []
flag = 1
for i in range(1, int(math.sqrt(n)) + 1):
	t.append(i * (i + 1))
k = len(t) - 1
for i in range(1, int(math.sqrt(n)) + 1):
	if binary_search(t, 0, k, n - i * (i + 1)):
		print('YES')
		flag = 0
		break
if flag:
	print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
st = set()
for k in range(1, 10 ** 5):
	st.add(k * (k + 1) // 2)
for _ in range(int(input()) if not True else 1):
	n = int(input())
	pos = False
	for each in st:
		if n - each in st:
			print('YES')
			pos = True
			break
	if not pos:
		print('NO')