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.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)!

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

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

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

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class prA {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        long n = Integer.parseInt(br.readLine());
        long k;
        for(int i = 1; (k = (i + 1) * i / 2) < n; i++) {
            long p = n - k;
            if(Math.abs(Math.sqrt(1 + 8 * p) - Math.floor(Math.sqrt(1 + 8 * p) + 1e-10)) < 1e-9) {
                System.out.println("YES");
                System.exit(0);
            }
        }
        System.out.println("NO");
        System.exit(0);
    }
}

import java.util.*;
import java.lang.*;

public class FunkyNum{

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		int n = in.nextInt();

		int i = 1;

		int sum = 0;

		ArrayList<Integer> list = new ArrayList<Integer>();

		while(sum <= n)
		{
			sum+=i;
			list.add(sum);
			i++;
		}

		if(list.get(list.size() - 1) == n)
		{
			System.out.println("YES");
			return;
		}

		for(i = 0 ; i < list.size() ; i++){

			int cur = list.get(i);
			int target = n - cur;

			if(binary(list,target))
			{
				System.out.println("YES");
				return;
			}

		}

		System.out.println("NO");
			return;

}

static boolean binary(ArrayList<Integer> arr, int target){

	int start = 0;
	int end = arr.size() - 1;

	while(start <= end){

		int mid = start + (end - start) / 2;

		if(arr.get(mid) == target)
			return true;
		else if(arr.get(mid) < target)
			start = mid + 1;
		else
			end = mid - 1;
	}

	return false;
}
}

import java.util.Scanner;

/**
 *
 * @author Ahmed
 */
public class FunkyNumbers {

    public static boolean isTriangularNumber(long num) {
        if(num == 0)
            return false;
        long calc_num = 8 * num + 1;
        long t = (long) Math.sqrt(calc_num);
        return t * t == calc_num;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String res = "NO";

        int m = (int) Math.sqrt(n * 2);
        for (int i = m; i > 0; i--) {
            if (isTriangularNumber(n - (i * (i + 1) / 2))) {
                res = "YES";
                break;
            }
        }

        System.out.println(res);
    }
}

import java.util.*;

public class Main111 {
    public static void main(String[] args) {

        Scanner in = new Scanner (System.in);

        int n=in.nextInt();

        ArrayList<Integer> list = new ArrayList<>();
        list.add(1);

        for (int i = 1; i <=n; i++)
        {
            int x=list.get(i-1)+(i+1);
            if(x>n)break;
            list.add(x);
        }

        int i=0,j=list.size()-1;
        while(i<list.size())
        {
            while(list.get(i)+list.get(j)>n&&j>0)j--;
            if(list.get(i)+list.get(j)==n)
            {
                System.out.println("YES");
                return;
            }
            i++;
        }

        System.out.println("NO");

    }

}

import java.util.HashSet;
import java.util.Scanner;

public class A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        HashSet<Long> H = new HashSet<Long>();
        for (long i = 1; (i * (i + 1)) < 2 * n; i++) {
            H.add((i * (i + 1)) / 2);
            if (H.contains(n - (i * (i + 1)) / 2)) {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int size = n*2;
        for(int i = 1; i * i < size+1; i++){
            int remain = size - i*(i+1);
            int q = (int)Math.sqrt(remain);
            if(q == 0) continue;
            if(q*(q+1) == remain){
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}

import java.util.Scanner;

/**
 *
 * @author Ahmed
 */
public class FunkyNumbers {

    public static boolean isTriangularNumber(long num) {
        if(num == 0)
            return false;
        long t = (long) Math.sqrt(2*num);
        return t * (t+1) == 2*num;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String res = "NO";

        int m = (int) Math.sqrt(n);
        for (int i = m; i > 0; i--) {
            if (isTriangularNumber(n - (i * (i + 1) / 2))) {
                res = "YES";
                break;
            }
        }

        System.out.println(res);
    }
}

import java.util.*;
public class d {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong(), k = 1;
        long sum = 0;
        HashMap<Long, Integer> f = new HashMap<>();
        while (sum < n) {
            sum = k * (k + 1) / 2;
            f.putIfAbsent(sum, 0);
            f.putIfAbsent(n - sum, 0);
            f.put(sum, f.get(sum) + 1);
            f.put(n - sum, f.get(n - sum) + 1);
            if (f.get(n - sum) > 1 || f.get(sum) > 1) {

                System.out.println("YES");
                return;
            }
            k++;

        }

        System.out.println("NO");
    }
}

import java.util.Scanner;

public class Funky_numbers
{

	public static int bin_search(int arr[], long find, int low, int high)
	{
		int middle = (int)(low + high)/2;

		if (low > high)
			return -1;

		if (arr[middle] < find)
			return bin_search (arr, find, middle+1, high);

		else if (arr[middle]>find)
			return bin_search (arr,find,low, middle-1);

		else
			return 1;
	}

	public static void funky (int n)
	{
		int cnt = 1;

		while (cnt*(cnt+1)/2<=n)
		{
			cnt++;
		}

			int [] niz = new int [cnt+1];

			niz[1] = 1;

			for (int j = 2; j<=cnt; j++)
			{
				niz [j] = niz [j-1] + j;
			}

			int find;

			for (int i = 1; i<=cnt; i++)
			{
				find = n - niz[i];

				if (bin_search (niz, find, i, cnt)==1)
					{
						System.out.println("YES");
						return;
					}
			}
			System.out.println("NO");
	}

	public static void main(String[] args)
	{
		Scanner s = new Scanner (System.in);
		int n = s.nextInt();
		funky (n);
	}

}

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Timer;
import java.util.TreeSet;

public class Main {

	public static void main(String[] args) throws Exception {

		int n = nextInt();
		TreeSet<Integer> t = new TreeSet<Integer>();
		for(int i = 1; ; i++){
			int a = (i * ( i + 1) ) / 2;
			if (a > 1000000000) break;
			t.add(a);
		}
		for(int a : t){
			if(a >= n) break;
			int res = n - a;
			if(t.contains(res)) exit("YES");
		}
		exit("NO");

	}

	private static PrintWriter out =  new PrintWriter(System.out);;
	private static BufferedReader inB = new BufferedReader(new InputStreamReader(System.in));
	private static StreamTokenizer in = new StreamTokenizer(inB);

	private static void exit(Object o) throws Exception {
		out.println(o);
		out.flush();
		System.exit(0);
	}
	private static void println(Object o) throws Exception{
		out.println(o);
		out.flush();
	}
	private static void print(Object o) throws Exception{
		out.print(o);
		out.flush();
	}
	private static int nextInt() throws Exception {
		in.nextToken();
		return (int)in.nval;
	}
	private static String nextString() throws Exception {
		in.nextToken();
		return in.sval;
	}
}

import java.io.*;
import java.security.SecureRandom;
import java.util.*;
import java.math.*;
import java.awt.geom.*;

import static java.lang.Math.*;

public class Solution implements Runnable {

	public void solve() throws Exception {
		long n = sc.nextLong();

		TreeSet<Long> arr = new TreeSet<>();
		for(long x = 1;; ++ x) {
			arr.add(x * (x + 1) / 2);
			if (x * (x + 1) / 2 > n)
				break;
		}
		for (long x : arr) {
			long y = n - x;
			if (y > 0 && arr.contains(y)) {
				out.println("YES");
				return;
			}
		}
		out.println("NO");
    }

    /*--------------------------------------------------------------*/

    static String filename = "";
    static boolean fromFile = false;

    BufferedReader in;
    PrintWriter out;
    FastScanner sc;

    public static void main(String[] args) {
        new Thread(null, new Solution(), "", 1 << 25).start();
    }

    public void run() {
        try {
            init();
            solve();
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            out.close();
        }
    }

    void init() throws Exception {
    	if (fromFile) {
    		in = new BufferedReader(new FileReader(filename+".in"));
        	out = new PrintWriter(new FileWriter(filename+".out"));
    	} else {
    		in = new BufferedReader(new InputStreamReader(System.in));
        	out = new PrintWriter(System.out);
    	}
        sc = new FastScanner(in);
    }
}

class FastScanner {

    BufferedReader reader;
    StringTokenizer strTok;

    public FastScanner(BufferedReader reader) {
        this.reader = reader;
    }

    public String nextToken() throws IOException {
        while (strTok == null || !strTok.hasMoreTokens()) {
            strTok = new StringTokenizer(reader.readLine());
        }

        return strTok.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    public BigInteger nextBigInteger() throws IOException {
    	return new BigInteger(nextToken());
    }

    public BigDecimal nextBigDecimal() throws IOException {
    	return new BigDecimal(nextToken());
    }
}

import java.io.*;
import java.util.*;

public class FunkyNumbers {
    public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        long n = Long.parseLong(f.readLine());
        int i = 1;
        while (i*(i+1)/2 < n) {
            long x = n-i*(i+1)/2;
            if (isSquare(1+8*x)) {
                System.out.println("YES");
                return;
            }
            i++;
        }
        System.out.println("NO");
    }

    public static boolean isSquare(long n) {
        long m = Math.round(Math.sqrt(n));
        return n == m*m;
    }
}

import java.util.Scanner;
public class apples {

	public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
         for(int i=1;i*(i+1)<=2*n;i++){
        	 long t=2*n-i*(i+1);
        	 double k1=(double)(-1+Math.sqrt(1+4*t))/2;
        	 double k2=(double)(-1-Math.sqrt(1+4*t))/2;
        	 if(k1>0 && k1%10==(long)k1%10) { System.out.println("YES"); return; }
        	 if(k2>0 && k2%10==(long)k2%10) { System.out.println("YES"); return; }
         }
         System.out.println("NO");
        }
}

import java.util.*;

public class Main
{

	public static void main(String[] args)
	{

		ArrayList<Integer> vals = new ArrayList<Integer>();

		int i;
		for (int k=0;k < 44720;k++)
		{
			i = k+1;
			vals.add( i * (i + 1) / 2);
		}

		int n = new Scanner(System.in).nextInt();

		for (i=0;i < 44720;++i)
		{

			if (vals.get(i) > n)
			{
				System.out.println("NO");
				return;
			}

			if (Collections.binarySearch(vals, n - vals.get(i)) >= 0)
			{
				System.out.println("YES");
				return;
			}
		}

		System.out.println("NO");

	}
}

import java.io.*;
import java.util.*;

public class a121
{
	public static void main(String[] args) throws Exception
	{
		InputReader in = new InputReader(System.in);
		OutputWriter out = new OutputWriter(System.out);
		int n=in.readInt();
		int a[]=new int[(int)Math.sqrt(n*2)+2];
		for(int i=0;i<=(int)Math.sqrt(n*2)+1;i++)
		a[i]=(i*(i+1))/2;

		int flag=0;
		for(int i=1;i<=(int)Math.sqrt(n*2)+1;i++)
		{
			int left=i,right=(int)Math.sqrt(n*2)+1,mid;
				while (left < right)
				{
					mid = left + (right - left) / 2;
					if(a[i]+a[mid]>=n)
					{
						right=mid;}//out.printLine(s(mid,k));}
					else
						left=mid+1;
				}
				if(a[left]+a[i]==n){
				out.printLine("YES");flag=1;break;}
			}
				if(flag==0)
				out.printLine("NO");
		out.close();
	}

	private static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int read()
		{
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				} catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (numChars <= 0)
				return -1;
			}
			return buf[curChar++];
		}
		public int readInt()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public long readLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
		public String readString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter
		{
			public boolean isSpaceChar(int ch);
		}
	}

	private static class OutputWriter
	{
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream)
		{
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer)
		{
			this.writer = new PrintWriter(writer);
		}
 		public void print(Object... objects)
		{
			for (int i = 0; i < objects.length; i++)
			{
				if (i != 0)
				writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void printLine(Object... objects)
		{
			print(objects);
			writer.println();
		}

		public void close()
		{
			writer.close();
		}

		public void flush()
		{
			writer.flush();
		}

	}
}

//Edwin Lunando template for online algorithm contest
import java.io.*;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

//  class node implements Comparable<node> {
//
//    public int a;
//    public int b;
//
//    public int compareTo(node a) {
//      if (a.b == this.b) {
//        return a.a - this.a;
//      } else {
//        return a.b - this.b;
//      }
//    }
//
//    public node(int a, int b) {
//      this.a = a;
//      this.b = b;
//    }
//  }

  private boolean isTriangle(int n) {
    int count = 0;
    int number = 0;
    while (number < n) {
      number = count * (count + 1) / 2;
      if (number == n) {
        return true;
      }
      count++;
    }
    return false;
  }

  private void solve() throws IOException {
    int n = nextInt();
    int count = 0;
    boolean check = false;
    int y = 0, x = 0;
    TreeSet<Integer> ts = new TreeSet<Integer>();

    for (int a= 1 ; a < 10000000; a++) {
      long val =  a * (a + 1L) / 2;
      if (val > n) {
        break;
      }
      ts.add((int)val);
    }

    for (int v : ts) {
      int nn = n - v;
      if (ts.contains(nn)) {
        check = true;
        break;
      }
    }
    System.out.println((check)?"YES" : "NO");
  }

  public static void main(String[] args) {
    try {
      br = new BufferedReader(new InputStreamReader(System.in));
      //br = new BufferedReader(new FileReader("input.txt"));
      //out = new PrintWriter(System.out);
      out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
      out.println("test");
      new Main().solve();
      out.close();
    } catch (Throwable e) {
      System.out.println(e);
      System.exit(239);
    }
  }
  static BufferedReader br;
  static StringTokenizer st;
  static PrintWriter out;

  static String nextToken() throws IOException {
    while (st == null || !st.hasMoreTokens()) {
      String line = br.readLine();
      if (line == null) {
        return null;
      }
      st = new StringTokenizer(line);
    }
    return st.nextToken();
  }

  static int nextInt() throws IOException {
    return Integer.parseInt(nextToken());
  }

  static long nextLong() throws IOException {
    return Long.parseLong(nextToken());
  }

  static double nextDouble() throws IOException {
    return Double.parseDouble(nextToken());
  }

  static int[] nextIntArray(int n) throws IOException {
    int[] temp = new int[n];
    for (int x = 0; x < n; x++) {
      temp[x] = nextInt();
    }
    return temp;
  }

  static long[] nextLongArray(int n) throws IOException {
    long[] temp = new long[n];
    for (int x = 0; x < n; x++) {
      temp[x] = nextLong();
    }
    return temp;
  }

  static String[] nextArray(int n) throws IOException {
    String[] temp = new String[n];
    for (int x = 0; x < n; x++) {
      temp[x] = nextToken();
    }
    return temp;
  }
}

import java.util.*;

public class CF121A {

    Scanner in = new Scanner(System.in);

    void run() {
        int n = in.nextInt();
        Set<Integer> nums = new TreeSet<Integer>();

        for (int i = 1, s = 0; s < 1000000000;) {
            s += (i++);
            nums.add(s);
        }

        for (Integer i : nums) {
            if (i >= n) {
                break;
            }

            if (nums.contains(n - i)) {
                System.out.println("YES");
                return;
            }
        }

        System.out.println("NO");
    }

    public static void main(String... args) {
        (new CF121A()).run();
    }

}

import java.util.*;
import java.io.*;
import java.awt.Point;
import java.math.BigDecimal;
import java.math.BigInteger;

import static java.lang.Math.*;

// Solution is at the bottom of code

public class A implements Runnable{

	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

	BufferedReader in;
	OutputWriter out;
	StringTokenizer tok = new StringTokenizer("");

	public static void main(String[] args){
		new Thread(null, new A(), "", 128 * (1L << 20)).start();
	}

	/////////////////////////////////////////////////////////////////////

	void init() throws FileNotFoundException{
		Locale.setDefault(Locale.US);

		if (ONLINE_JUDGE){
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new OutputWriter(System.out);
		}else{
			in = new BufferedReader(new FileReader("input.txt"));
			out = new OutputWriter("output.txt");
		}
	}

	////////////////////////////////////////////////////////////////

	long timeBegin, timeEnd;

	void time(){
		timeEnd = System.currentTimeMillis();
		System.err.println("Time = " + (timeEnd - timeBegin));
	}

	void debug(Object... objects){
		if (ONLINE_JUDGE){
			for (Object o: objects){
				System.err.println(o.toString());
			}
		}
	}

	/////////////////////////////////////////////////////////////////////

	public void run(){
		try{
			timeBegin = System.currentTimeMillis();
			Locale.setDefault(Locale.US);

			init();
			solve();

			out.close();
			time();
		}catch (Exception e){
			e.printStackTrace(System.err);
			System.exit(-1);
		}
	}

	/////////////////////////////////////////////////////////////////////

	String delim = " ";

	String readString() throws IOException{
		while(!tok.hasMoreTokens()){
			try{
				tok = new StringTokenizer(in.readLine());
			}catch (Exception e){
				return null;
			}
		}

		return tok.nextToken(delim);
	}

	String readLine() throws IOException{
		return in.readLine();
	}

	/////////////////////////////////////////////////////////////////

	final char NOT_A_SYMBOL = '\0';

	char readChar() throws IOException{
		int intValue = in.read();

		if (intValue == -1){
			return NOT_A_SYMBOL;
		}

		return (char) intValue;
	}

	char[] readCharArray() throws IOException{
		return readLine().toCharArray();
	}

	/////////////////////////////////////////////////////////////////

	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	int[] readIntArray(int size) throws IOException {
		int[] array = new int[size];

		for (int index = 0; index < size; ++index){
			array[index] = readInt();
		}

		return array;
	}

	int[] readIntArrayWithDecrease(int size) throws IOException {
		int[] array = readIntArray(size);

		for (int i = 0; i < size; ++i) {
			array[i]--;
		}

		return array;
	}

	///////////////////////////////////////////////////////////////////

	long readLong() throws IOException{
		return Long.parseLong(readString());
	}

	long[] readLongArray(int size) throws IOException{
		long[] array = new long[size];

		for (int index = 0; index < size; ++index){
			array[index] = readLong();
		}

		return array;
	}

	////////////////////////////////////////////////////////////////////

	double readDouble() throws IOException{
		return Double.parseDouble(readString());
	}

	double[] readDoubleArray(int size) throws IOException{
		double[] array = new double[size];

		for (int index = 0; index < size; ++index){
			array[index] = readDouble();
		}

		return array;
	}

	////////////////////////////////////////////////////////////////////

	BigInteger readBigInteger() throws IOException {
		return new BigInteger(readString());
	}

	BigDecimal readBigDecimal() throws IOException {
		return new BigDecimal(readString());
	}

	/////////////////////////////////////////////////////////////////////

	Point readPoint() throws IOException{
		int x = readInt();
		int y = readInt();
		return new Point(x, y);
	}

	Point[] readPointArray(int size) throws IOException{
		Point[] array = new Point[size];

		for (int index = 0; index < size; ++index){
			array[index] = readPoint();
		}

		return array;
	}

	/////////////////////////////////////////////////////////////////////

	List<Integer>[] readGraph(int vertexNumber, int edgeNumber)
	throws IOException{
		@SuppressWarnings("unchecked")
		List<Integer>[] graph = new List[vertexNumber];

		for (int index = 0; index < vertexNumber; ++index){
			graph[index] = new ArrayList<Integer>();
		}

		while (edgeNumber-- > 0){
			int from = readInt() - 1;
			int to = readInt() - 1;

			graph[from].add(to);
			graph[to].add(from);
		}

		return graph;
	}

	/////////////////////////////////////////////////////////////////////

	static class IntIndexPair {

		static Comparator<IntIndexPair> increaseComparator = new Comparator<A.IntIndexPair>() {

			@Override
			public int compare(IntIndexPair indexPair1, IntIndexPair indexPair2) {
				int value1 = indexPair1.value;
				int value2 = indexPair2.value;

				if (value1 != value2) return value1 - value2;

				int index1 = indexPair1.index;
				int index2 = indexPair2.index;

				return index1 - index2;
			}
		};

		static Comparator<IntIndexPair> decreaseComparator = new Comparator<A.IntIndexPair>() {

			@Override
			public int compare(IntIndexPair indexPair1, IntIndexPair indexPair2) {
				int value1 = indexPair1.value;
				int value2 = indexPair2.value;

				if (value1 != value2) return -(value1 - value2);

				int index1 = indexPair1.index;
				int index2 = indexPair2.index;

				return index1 - index2;
			}
		};

		int value, index;

		public IntIndexPair(int value, int index) {
			super();
			this.value = value;
			this.index = index;
		}

		public int getRealIndex() {
			return index + 1;
		}
	}

	IntIndexPair[] readIntIndexArray(int size) throws IOException {
		IntIndexPair[] array = new IntIndexPair[size];

		for (int index = 0; index < size; ++index) {
			array[index] = new IntIndexPair(readInt(), index);
		}

		return array;
	}

	/////////////////////////////////////////////////////////////////////

	static class OutputWriter extends PrintWriter{

		final int DEFAULT_PRECISION = 12;

		int precision;
		String format, formatWithSpace;

		{
			precision = DEFAULT_PRECISION;

			format = createFormat(precision);
			formatWithSpace = format + " ";
		}

		public OutputWriter(OutputStream out) {
			super(out);
		}

		public OutputWriter(String fileName) throws FileNotFoundException {
			super(fileName);
		}

		public int getPrecision() {
			return precision;
		}

		public void setPrecision(int precision) {
			precision = max(0, precision);
			this.precision = precision;

			format = createFormat(precision);
			formatWithSpace = format + " ";
		}

		private String createFormat(int precision){
			return "%." + precision + "f";
		}

		@Override
		public void print(double d){
			printf(format, d);
		}

		public void printWithSpace(double d){
			printf(formatWithSpace, d);
		}

		public void printAll(double...d){
			for (int i = 0; i < d.length - 1; ++i){
				printWithSpace(d[i]);
			}

			print(d[d.length - 1]);
		}

		@Override
		public void println(double d){
			printlnAll(d);
		}

		public void printlnAll(double... d){
			printAll(d);
			println();
		}
	}

	/////////////////////////////////////////////////////////////////////

	int[][] steps = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
	int[][] steps8 = {
			{-1, 0}, {1, 0}, {0, -1}, {0, 1},
			{-1, -1}, {1, 1}, {1, -1}, {-1, 1}
	};

	boolean check(int index, int lim){
		return (0 <= index && index < lim);
	}

	/////////////////////////////////////////////////////////////////////

	boolean checkBit(int mask, int bitNumber){
		return (mask & (1 << bitNumber)) != 0;
	}

	/////////////////////////////////////////////////////////////////////

	void solve() throws IOException {
		int n = readInt();

		String answer = checkNumber(n)? "YES": "NO";
		out.println(answer);
	}

	int MAX_N = 1000 * 1000 * 1000;

	private boolean checkNumber(int n) {
		Set<Integer> triangles = new HashSet<Integer>();
		for (int i = 1, triangle = i; triangle < MAX_N; ++i, triangle += i) {
			triangles.add(triangle);
		}

		for (int first = 1, firstNumber = first; firstNumber < n; ++first, firstNumber += first) {
			if (triangles.contains(n - firstNumber)) return true;
		}

		return false;
	}
}

import java.io.*;

import java.text.NumberFormat;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;

import javax.print.attribute.HashAttributeSet;

public class CodeForces {

	public void solve() throws IOException {

		int n = nextInt();
		String answer = "NO";
		int res = 0;
		List<Integer> ls = new ArrayList<Integer>();
		int c=1;
		while(res<n){
			res = c*(c+1)/2;
			ls.add(res);
			c++;
		}
		Collections.sort(ls);
		for(int i:ls){
			if(Collections.binarySearch(ls, n-i)>=0){
				answer="YES";
				break;
			}
		}
		out.println(answer);
	}

	private boolean isPal(String s) {
		boolean retValue = true;
		for (int i = 0, l = s.length() / 2; i < l; i++) {
			if (s.charAt(i) != s.charAt(s.length() - i - 1)) {
				retValue = false;
				break;
			}
		}
		return retValue;
	}

	public static void main(String[] args) {
		new CodeForces().run();
	}

	long NOD(long a, long b) {
		while (a != 0 && b != 0) {
			if (a >= b)
				a = a % b;
			else
				b = b % a;
		}
		return a + b;
	}

	BufferedReader reader;
	StringTokenizer tokenizer;
	PrintWriter out;
	boolean isOuterFile = false;

	public void run() {
		try {
			if (isOuterFile) {
				reader = new BufferedReader(new FileReader("input.txt"));
				out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
				out = new PrintWriter(System.out);
			} else {
				reader = new BufferedReader(new InputStreamReader(System.in));
				out = new PrintWriter(System.out);
			}

			tokenizer = null;
			// long t=new Date().getTime();
			solve();
			// writer.println(t-new Date().getTime());
			reader.close();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;

public class Main {
	public static void main(String[] args) throws IOException {
		(new Main()).solve();
	}

	public void Main() {
	}

	void solve() throws IOException {
		// BufferedReader in = new BufferedReader(new
		// InputStreamReader(System.in));
		// Scanner in = new Scanner(System.in);
		MyReader in = new MyReader();
		PrintWriter out = new PrintWriter(System.out);
		// Scanner in = new Scanner(new FileReader("input.txt"));
		// PrintWriter out = new PrintWriter("output.txt");

		int n = in.nextInt();
		int k = 1;
		while (k * (k + 1) <= n) {
			int t = (int) Math.sqrt(2 * n - k * (k + 1) + 0.01);
			if (k * (k + 1) + t * (t + 1) == 2 * n) {
				out.print("YES");
				out.close();
				return;
			} else {
				k++;
			}
		}

		out.print("NO");

		out.close();
	}

};

class MyReader {
	private BufferedReader in;
	String[] parsed;
	int index = 0;

	public MyReader() {
		in = new BufferedReader(new InputStreamReader(System.in));
	}

	public int nextInt() throws NumberFormatException, IOException {
		if (parsed == null || parsed.length == index) {
			read();
		}
		return Integer.parseInt(parsed[index++]);
	}

	public long nextLong() throws NumberFormatException, IOException {
		if (parsed == null || parsed.length == index) {
			read();
		}
		return Long.parseLong(parsed[index++]);
	}

	public String nextString() throws IOException {
		if (parsed == null || parsed.length == index) {
			read();
		}
		return parsed[index++];
	}

	private void read() throws IOException {
		parsed = in.readLine().split(" ");
		index = 0;
	}

	public String readLine() throws IOException {
		return in.readLine();
	}
};

import java.util.*;
public class A {
	Scanner sc = new Scanner(System.in);
	void doIt()
	{
		long N = sc.nextLong();
		ArrayList<Long> tri = new ArrayList<Long>();
		for(long k = 1; ; k++) {
			long n = k * (k + (long)1) / (long)2;
			if(n > N) break;
			tri.add(n);
		}
		//System.out.println(tri.size());
		int small = 0, large = tri.size() - 1;
		while(small <= large) {
			long sum = tri.get(small) + tri.get(large);
			if(sum == N) {
				System.out.println("YES");
				return;
			}
			else if(sum > N) large--;
			else small++;
		}
		System.out.println("NO");
	}

	public static void main(String[] args) {
		new A().doIt();
	}

}

import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;

public class Codeforces {

    static double Phi = (1 + Math.sqrt(5)) / 2.0;
    static int MAX = -1 >>> 1;
    static long MODL = 1_000_000_007L;
    static int MOD = 1_000_000_007;

    static void main2() throws Exception {
        int n = ni();
        Set<Integer> tn = new HashSet<>();
        for(int i = 1; ; i++) {
            int tntemp = (i * (i + 1)) >> 1;
            if(tntemp >= n) break;
            tn.add(tntemp);
            if(tn.contains(n - tntemp)) {
                println("YES");
                return;
            }
        }
        println("NO");
    }
    //            /$$
    //           | $$
    //   /$$$$$$$| $$  /$$$$$$   /$$$$$$$ /$$$$$$$  /$$$$$$   /$$$$$$$
    //  /$$_____/| $$ |____  $$ /$$_____//$$_____/ /$$__  $$ /$$_____/
    // | $$      | $$  /$$$$$$$|  $$$$$$|  $$$$$$ | $$$$$$$$|  $$$$$$
    // | $$      | $$ /$$__  $$ \____  $$\____  $$| $$_____/ \____  $$
    // |  $$$$$$$| $$|  $$$$$$$ /$$$$$$$//$$$$$$$/|  $$$$$$$ /$$$$$$$/
    //  \_______/|__/ \_______/|_______/|_______/  \_______/|_______/

    static class Pair <L, R> {
        L first;
        R second;

        Pair(L first, R second) {
            this.first = first;
            this.second = second;
        }

        Pair(Pair<L, R> p) {
            this.first = p.first;
            this.second = p.second;
        }

        public boolean equals(Object p2) {
            if (p2 instanceof Pair) {
                return ((Pair) p2).first.equals(first) && ((Pair) p2).second.equals(second);
            }
            return false;
        }

        public String toString() {
            return "(first=" + first.toString() + ",second=" + second.toString() + ")";
        }
    }

    static class DisjointSet {
        int[] arr;
        int[] size;
        boolean enableSize = true;

        DisjointSet(int n) {
            arr = new int[n + 1];
            this.enableSize = enableSize;
            if (this.enableSize) size = new int[n + 1];
            makeSet();
        }

        void makeSet() {
            for (int i = 1; i < arr.length; i++) {
                arr[i] = i;
                if (enableSize) size[i] = 1;
            }
        }

        void union(int i, int j) {
            i = find(i);
            j = find(j);

            if (i == j)
                return;
            arr[j] = arr[i];
            if (enableSize) {
                size[i] += size[j];
                size[j] = size[i];
            }
        }

        int find(int i) {
            if (i == arr[i]) return i;
            return arr[i] = find(arr[i]);
        }

        int getSize(int i) {
            if (enableSize) return size[find(i)];
            return 0;
        }

        public String toString() {
            return Arrays.toString(arr);
        }
    }

    //              /$$     /$$ /$$
    //             | $$    |__/| $$
    //  /$$   /$$ /$$$$$$   /$$| $$  /$$$$$$$
    // | $$  | $$|_  $$_/  | $$| $$ /$$_____/
    // | $$  | $$  | $$    | $$| $$|  $$$$$$
    // | $$  | $$  | $$ /$$| $$| $$ \____  $$
    // |  $$$$$$/  |  $$$$/| $$| $$ /$$$$$$$/
    //  \______/    \___/  |__/|__/|_______/

    static int diff(int a, int b) {
        return abs(a - b);
    }

    static long diff(long a, long b) {
        return abs(a - b);
    }

    static boolean isSqrt(double a) {
        double sr = Math.sqrt(a);
        return ((sr - Math.floor(sr)) == 0);
    }

    static long abs(long a) {
        return Math.abs(a);
    }

    static int abs(int a) {
        return Math.abs(a);
    }

    static int min(int ... arr) {
        int min = Integer.MAX_VALUE;
        for (int var : arr)
            min = Math.min(min, var);
        return min;
    }

    static long min(long ... arr) {
        long min = Long.MAX_VALUE;
        for (long var : arr)
            min = Math.min(min, var);
        return min;
    }

    static long max(long ... arr) {
        long max = Long.MIN_VALUE;
        for (long var : arr)
            max = Math.max(max, var);
        return max;
    }

    static int max(int... arr) {
        int max = Integer.MIN_VALUE;
        for (int var : arr)
            max = Math.max(max, var);
        return max;
    }

    static long modInverse(long a) {
        long[] g = gcde(a, MODL);
        long x = g[1], y = g[2];
        if (g[0] != 1)
            return 0;
        else {
            // m is added to handle negative x
            return (g[1] % MODL + MODL) % MODL;
        }
    }

    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    static long[] gcde(long a, long b) {
        // Base Case
        if (a == 0) {
            return new long[] {b, 0, 1};
        }

        long[] gcd = gcde(b % a, a);
        long x1 = gcd[1], y1 = gcd[2]; // To store results of recursive call

        // Update x and y using results of recursive
        // call
        gcd[1] = y1 - (b / a) * x1;
        gcd[2] = x1;

        return gcd;
    }

    // ____________________________________________________________________________
    //|                                                                            |
    //|  /$$$$$$  /$$$$$$         /$$$$$$   /$$                /$$$$$$   /$$$$$$   |
    //| |_  $$_/ /$$__  $$       /$$__  $$ | $$               /$$__  $$ /$$__  $$  |
    //|   | $$  | $$  \ $$      | $$  \__//$$$$$$   /$$   /$$| $$  \__/| $$  \__/  |
    //|   | $$  | $$  | $$      |  $$$$$$|_  $$_/  | $$  | $$| $$$$    | $$$$      |
    //|   | $$  | $$  | $$       \____  $$ | $$    | $$  | $$| $$_/    | $$_/      |
    //|   | $$  | $$  | $$       /$$  \ $$ | $$ /$$| $$  | $$| $$      | $$        |
    //|  /$$$$$$|  $$$$$$/      |  $$$$$$/ |  $$$$/|  $$$$$$/| $$      | $$        |
    //| |______/ \______/        \______/   \___/   \______/ |__/      |__/        |
    //|____________________________________________________________________________|

    private static byte[] scannerByteBuffer = new byte[1024]; // Buffer of Bytes
    private static int scannerIndex;
    private static InputStream scannerIn;
    private static int scannerTotal;
    private static BufferedWriter printerBW;
    private static boolean DEBUG = false;

    private static int next() throws IOException { // Scan method used to scan buf
        if (scannerTotal < 0)
            throw new InputMismatchException();
        if (scannerIndex >= scannerTotal) {
            scannerIndex = 0;
            scannerTotal = scannerIn.read(scannerByteBuffer);
            if (scannerTotal <= 0)
                return -1;
        }
        return scannerByteBuffer[scannerIndex++];
    }

    static int ni() throws IOException {
        int integer = 0;
        int n = next();
        while (isWhiteSpace(n)) // Removing startPointing whitespaces
            n = next();
        int neg = 1;
        if (n == '-') { // If Negative Sign encounters
            neg = -1;
            n = next();
        }
        while (!isWhiteSpace(n)) {
            if (n >= '0' && n <= '9') {
                integer *= 10;
                integer += n - '0';
                n = next();
            } else
                throw new InputMismatchException();
        }
        return neg * integer;
    }

    static long nl() throws IOException {
        long integer = 0;
        int n = next();
        while (isWhiteSpace(n)) // Removing startPointing whitespaces
            n = next();
        int neg = 1;
        if (n == '-') { // If Negative Sign encounters
            neg = -1;
            n = next();
        }
        while (!isWhiteSpace(n)) {
            if (n >= '0' && n <= '9') {
                integer *= 10;
                integer += n - '0';
                n = next();
            } else
                throw new InputMismatchException();
        }
        return neg * integer;
    }

    static String line() throws IOException {
        StringBuilder sb = new StringBuilder();
        int n = next();
        while (isWhiteSpace(n))
            n = next();
        while (!isNewLine(n)) {
            sb.append((char) n);
            n = next();
        }
        return sb.toString();
    }

    private static boolean isNewLine(int n) {
        return n == '\n' || n == '\r' || n == -1;
    }

    private static boolean isWhiteSpace(int n) {
        return n == ' ' || isNewLine(n) || n == '\t';
    }

    static int[] nia(int n) throws Exception {
        if (n < 0)
            throw new Exception("Array size should be non negative");
        int[] array = new int[n];
        for (int i = 0; i < n; i++)
            array[i] = ni();
        return array;
    }

    static int[][] n2dia(int r, int c) throws Exception {
        if (r < 0 || c < 0)
            throw new Exception("Array size should be non negative");
        int[][] array = new int[r][c];
        for (int i = 0; i < r; i++)
            array[i] = nia(c);
        return array;
    }

    static long[] nla(int n) throws Exception {
        if (n < 0)
            throw new Exception("Array size should be non negative");
        long[] array = new long[n];
        for (int i = 0; i < n; i++)
            array[i] = nl();
        return array;
    }

    static float[] nfa(int n) throws Exception {
        if (n < 0)
            throw new Exception("Array size should be non negative");
        float[] array = new float[n];
        for (int i = 0; i < n; i++)
            array[i] = nl();
        return array;
    }

    static double[] nda(int n) throws Exception {
        if (n < 0)
            throw new Exception("Array size should be non negative");
        double[] array = new double[n];
        for (int i = 0; i < n; i++)
            array[i] = nl();
        return array;
    }

    static <T> void print(T ... str) {
        try {
            for (T ele : str)
                printerBW.append(ele.toString());
            if (DEBUG)
                flush();
        } catch (IOException e) {
            System.out.println(e.toString());
        }
    }

    static <T> void println(T ... str) {
        if (str.length == 0) {
            print('\n');
            return;
        }
        for (T ele : str)
            print(ele, '\n');
    }

    static void flush() throws IOException {
        printerBW.flush();
    }

    static void close() {
        try {
            printerBW.close();
        } catch (IOException e) {
            System.out.println(e.toString());
        }
    }

    public static void main(String[] args) throws Exception {
        long startPointTime = System.currentTimeMillis();
        scannerIn = System.in;
        printerBW = new BufferedWriter(new OutputStreamWriter(System.out));
        if (args.length > 0 && args[0].equalsIgnoreCase("debug")
                || args.length > 1 && args[1].equalsIgnoreCase("debug"))
            DEBUG = true;

        main2();
        long endTime = System.currentTimeMillis();
        float totalProgramTime = endTime - startPointTime;
        if (args.length > 0 && args[0].equalsIgnoreCase("time") || args.length > 1 && args[1].equalsIgnoreCase("time"))
            print("Execution time is " + totalProgramTime + " (" + (totalProgramTime / 1000) + "s)");
        close();
    }
}

import java.io.*;
import java.util.StringTokenizer;

/**
 * Created by peacefrog on 11/5/15.
 * Time : 3:12 PM
 */

public class FunkyNumbers121A {
	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	PrintWriter out;
	long timeBegin, timeEnd;

	public void runIO() throws IOException {
		timeBegin = System.currentTimeMillis();

		InputStream inputStream;
		OutputStream outputStream;

		if (ONLINE_JUDGE) {
			inputStream = System.in;
			Reader.init(inputStream);
			outputStream = System.out;

			out = new PrintWriter(outputStream);

		} else {
			inputStream = new FileInputStream("/home/peacefrog/Dropbox/IdeaProjects/Problem Solving/input");
			Reader.init(inputStream);
			out = new PrintWriter("output.txt");
		}

		solve();

		out.flush();
		out.close();
		timeEnd = System.currentTimeMillis();

		System.err.println("Time = " + (timeEnd - timeBegin));

	}

	/*
	 * Start Solution Here
	 */

	private void solve() throws IOException {

		long  n = Reader.nextLong();
		boolean flag = false ;
		long lim = (long) Math.sqrt(n);
		for ( long  i = 1 ; i <= lim ; i++)
		{
			long k = (i * (i+1))/2 ;
			long temp = n - k;
			if(temp <= 0) continue;
			long t = (long) Math.sqrt(2 * temp);
			if (t * (t + 1) == 2 * temp) {
				out.println("YES");
				return;
			}

		}
		out.println("NO");
	}

	public static void main(String[] args) throws IOException {
		new FunkyNumbers121A().runIO();
	}

	static class Reader {
		static BufferedReader reader;
		static StringTokenizer tokenizer;

		/**
		 * call this method to initialize reader for InputStream
		 */
		static void init(InputStream input) {
			reader = new BufferedReader(new InputStreamReader(input));
			tokenizer = new StringTokenizer("");
		}

		/**
		 * get next word
		 */
		static String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		static String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return "";
		}

		static int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		static long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		static double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
	}
}

import java.io.*;
import java.util.*;
import java.math.*;

public class Main
{
	BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	StringTokenizer tokenizer=null;

	public static void main(String[] args) throws IOException
	{
		new Main().execute();
	}

	void debug(Object...os)
	{
		System.out.println(Arrays.deepToString(os));
	}

	int ni() throws IOException
	{
		return Integer.parseInt(ns());
	}

	long nl() throws IOException
	{
		return Long.parseLong(ns());
	}

	double nd() throws IOException
	{
		return Double.parseDouble(ns());
	}

	String ns() throws IOException
	{
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(br.readLine());
		return tokenizer.nextToken();
	}

	String nline() throws IOException
	{
		tokenizer=null;
		return br.readLine();
	}

	//Main Code starts Here
	int totalCases, testNum;
	int m,n;
	int mod = 1000000007;
	void execute() throws IOException
	{
		totalCases = 1;
		for(testNum = 1; testNum <= totalCases; testNum++)
		{
			input();
			solve();
		}
	}

	void solve()
	{
		boolean b = false;

		for(int i =1;i<=100000;i++)
		{
			int y = n-i*(i+1);
			if(y<0)
				break;
			if(bina(1,100000,y))
			{
				b = true;
				break;
			}
		}
		if(b)
			System.out.println("YES");
		else
			System.out.println("NO");
	}

	boolean bina(long a, long b, int c)
	{
		if(b<a)
			return false;
		long mid = (a+b)/2;
		if(mid*(mid+1)==c)
			return true;
		if(mid*(mid+1)>c)
			return bina(a,mid-1,c);
		else
			return bina(mid+1,b,c);
	}
	void printarr(int [] a,int b)
	{
		for(int i = 0;i<=b;i++)
		{
			if(i==0)
				System.out.print(a[i]);
			else
				System.out.print(" "+a[i]);
		}
		System.out.println();
	}

	boolean input() throws IOException
	{
		n = 2*ni();
		return true;
	}
}

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.TreeSet;

public class A {

    public static void main(String[] args) throws Exception {
        long n = nextInt();

        TreeSet<Long> ts = new TreeSet<Long>();

        for(long k = 1;;k++) {
            long cur = k*(k+1)/2;

            if(cur > 1000000010L)
                break;

            ts.add(cur);
        }

        for(long a : ts) {
            if(a > n)
                break;

            long b = (n - a);
            if(ts.contains(b)) {
                exit("YES");
            }
        }

        exit("NO");
    }

    // ///////////////////////////////////////////////////////////////
    // IO
    // ///////////////////////////////////////////////////////////////
    private static StreamTokenizer in;
    private static PrintWriter out;
    private static BufferedReader inB;

    private static boolean FILE = false;

    private static int nextInt() throws Exception {
        in.nextToken();
        return (int) in.nval;
    }

    private static String nextString() throws Exception {
        in.nextToken();
        return in.sval;
    }

    static {
        try {
            out = new PrintWriter(false ? (new FileOutputStream("out.txt"))
                    : System.out);
            inB = new BufferedReader(new InputStreamReader(
                    FILE ? new FileInputStream("lvl3.txt") : System.in));
        } catch (Exception e) {
            e.printStackTrace();
        }
        in = new StreamTokenizer(inB);
    }

    // ///////////////////////////////////////////////////////////////

    // ///////////////////////////////////////////////////////////////
    // pre - written
    // ///////////////////////////////////////////////////////////////
    private static void println(Object o) throws Exception {
        out.println(o);
        out.flush();
    }

    private static void exit(Object o) throws Exception {
        println(o);
        exit();
    }

    private static void exit() {
        System.exit(0);
    }

    private static final int INF = Integer.MAX_VALUE;
    private static final int MINF = Integer.MIN_VALUE;
    // ////////////////////////////////////////////////////////////////
}

import java.io.*;
import java.util.*;

public class Triangle {

	public static void main(String [] args) throws Exception{
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		HashSet<Integer> trinums = new HashSet<Integer>();
		int i = 1;
		while(true){
			int tri = i*(i+1)/2;

			if(tri>n)
				break;
			trinums.add(tri);
			i++;
		}
		boolean ya = false;
		for(int tri : trinums){
			if(trinums.contains(n-tri)){
				ya = true;
				break;
			}
		}
		if(ya)
			System.out.println("YES");
		else
			System.out.println("NO");
	}

}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author tengxiao
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
	public void solve(int testNumber, Scanner in, PrintWriter out) {
        long n=in.nextInt();
        boolean flag=false;
        for(long k=1;(k*k+k)<2*n;k++){
            long rem=2*n-(k*k+k);
            double sqr=Math.sqrt(4*rem+1);
            long sqri=(long)sqr;
            if(sqri*sqri==4*rem+1){
                if((sqri-1)%2==0)
                    flag=true;
            }
        }
        if(flag)
            out.println("YES");
        else
            out.println("NO");
	}
}

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        HashSet<Long> set = new HashSet<Long>();

        long k = 1;
        while(true){
            long t = k*(k+1)/2;
            if(t>=1000000000)
                break;
            set.add(t);
            k++;
        }
//      System.out.println(set.size());
        long n = s.nextLong();

        int ok = 0;
        for(long a:set){
            long b = n - a;
            if(set.contains(b)){
                ok = 1;
                break;
            }
        }
        if(ok==1)
            System.out.println("YES");
        else System.out.println("NO");
    }

}

import java.io.BufferedInputStream;
import java.util.Scanner;

/**
 * Created by jizhe on 2015/12/19.
 */
public class FunkyNumbers {
    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedInputStream(System.in));

        int n = in.nextInt();

        int i, funky = 0;
        for( i = 1; funky <= n/2+1; i++ )
        {
            funky = i*(i+1)/2;
            int second = n-funky;
            int root = (int)Math.pow(second*2, 0.5);
            if( root != 0 && root*(root+1) == second*2 )
            {
                System.out.printf("YES\n");
                //System.out.printf("%d*%d/2 + %d*%d/2\n", i, i+1, root, root+1);
                return;
            }
        }
        //System.out.printf("%d, %d\n", i, funky);
        System.out.printf("NO\n");
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class CF_192_A_FUNKY_NUMBERS {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		int len = (int) 5e4;
		TreeSet<Integer> set = new TreeSet<>();
		int[] freq = new int[len + 1];

		for (int i = 1; i <= len; i++)
			set.add(freq[i] = (int) ((1l * i * ((1l * i) + 1l)) >> 1l));

		for (int i = 1; i <= len; i++)
			if (set.contains((n - freq[i]))) {
				System.out.println("YES");
				return;
			}

		System.out.println("NO");
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

}

import java.util.HashSet;
import java.util.Scanner;

public class d2_121_a {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		test(n);
	}
	public static void test(int n) {
		int k = 1;
		int fn = 0;
		HashSet<Integer> set = new HashSet<Integer>();
		while (fn <= n) {
			fn = (k * (k+1)) / 2;
			set.add(fn);
			k ++;
		}
		for (Integer i : set) {
			if (set.contains(n-i)) {
				System.out.println("YES");
				return;
			}
		}
		System.out.println("NO");
	}

}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class C121P5 {

    private static BufferedReader in;
    private static PrintWriter out;
    private static StringTokenizer input;

    public static void main(String[] args) throws IOException {
        //-------------------------------------------------------------------------
        //Initializing...
        new C121P5();
        //-------------------------------------------------------------------------
        //put your code here... :)
//      System.out.println(50000/2 * 50001);
        int [] s = new int[50001];
        for (int i = 1; i < s.length; i++) {s[i]=((i&1)==0)?i/2 * (i+1):(i+1)/2 *i;}
        int n = nextInt();
        boolean done = false;
        for (int i = 1; i < s.length; i++) {
            if(s[i]>n)break;
            done = search(s,n-s[i]);
            if(done)break;
        }
        writeln(""+(done?"Yes":"No"));
        //-------------------------------------------------------------------------
        //closing up
        end();
        //--------------------------------------------------------------------------

    }
    private static boolean search(int[] s, int i) {
        // TODO Auto-generated method stub
        int l = 1;
        int h = 50000;
        if(s[l]==i)return true;
        if(s[h]==i)return true;
        while(h-l >1){
            int m = (l+ h)/2;
            if(s[m]==i)return true;
            if(s[m]<i)l=m;
            else h=m;
        }
        return false;
    }
    public C121P5() throws IOException {
        //Input Output for Console to be used for trying the test samples of the problem
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        //-------------------------------------------------------------------------
        //Initalize Stringtokenizer input
        input = new StringTokenizer(in.readLine());
    }

    private static int nextInt() throws IOException {
        if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine());
        return Integer.parseInt(input.nextToken());
    }
    private static long nextLong() throws IOException {
        if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine());
        return Long.parseLong(input.nextToken());
    }
    private static double nextDouble() throws IOException {
        if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine());
        return Double.parseDouble(input.nextToken());
    }
    private static String nextString() throws IOException {
        if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine());
        return input.nextToken();
    }
    private static void write(String output){
        out.write(output);
        out.flush();
    }
    private static void writeln(String output){
        out.write(output+"\n");
        out.flush();
    }
    private static void end() throws IOException{
        in.close();
        out.close();
        System.exit(0);
    }

}

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Task192A {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {
		private static boolean isTriangle(int n) {
			int cand = (int) Math.sqrt(2 * n);
			return cand * (cand + 1) == 2 * n;
		}

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			boolean answer = false;

			for (int k = 1; k * (k + 1) / 2 < n; k++) {
				if (isTriangle(n - k * (k + 1) / 2)) {
					answer = true;
					break;
				}
			}

			pw.println(answer ? "YES" : "NO");

			s.close();
			pw.flush();
		}

	}

}

import java.util.*;
public class Funky {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);

        int num = in.nextInt();
        for (int i = 1 ; i < num ; i++){
            int k1 = (int)(Math.sqrt((num-(i*(i+1)/2))*2));

            if (k1 == 0)
                {
                    System.out.println("NO");
                    return;
                }

            if ((i*(i+1)/2)+ k1*(k1+1)/2== num)
            {
                System.out.println("YES");
                return;
            }
        }
            System.out.println("NO");
    }
}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.Character.Subset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;

import javax.management.RuntimeErrorException;

public class Codeforces {

    StringTokenizer tok;
    BufferedReader in;
    PrintWriter out;

    final boolean OJ = System.getProperty("ONLINE_JUDGE") != null;

    void init() {
        try {
            if (OJ) {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            } else {
                in = new BufferedReader(new FileReader("input.txt"));
                out = new PrintWriter("output.txt");
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    String readString() {
        try {
            while (tok == null || !tok.hasMoreTokens()) {
                tok = new StringTokenizer(in.readLine());
            }
            return tok.nextToken();
        } catch (Throwable t) {
            throw new RuntimeException(t);
        }
    }

    int readInt() {
        return Integer.parseInt(readString());
    }

    public static void main(String[] args) {
        new Codeforces().run();
    }

    void run() {
        init();
        long time = System.currentTimeMillis();
        solve();
        System.err.println(System.currentTimeMillis() - time);
        out.close();
    }

    void solve() {
        int n = readInt();
        int max = (int)1e9;
        HashSet<Integer> set = new HashSet<Integer>();
        for (int i=1;;i++) {
            long x = (long) i * (i + 1) / 2;
            if (x > max) break;
            set.add((int)x);
        }

        for (int i : set) {
            if (n != i && set.contains(n - i)) {
                out.println("YES");
                return;
            }
        }
        out.println("NO");
    }

}

import java.util.*;

public class Main
{
    public static void main( String[] args )
    {
        Scanner in = new Scanner( System.in );
        int n = in.nextInt();
        boolean yes = false;
        for ( int i = 1; i * ( i + 1 ) <= n; i++ )
        {
            int b = n * 2 - i * ( i + 1 );
            int left = 1;
            int right = ( int ) Math.sqrt( b ) + 1;
            while ( left < right )
            {
                int mid = ( left + right ) >> 1;
                if ( mid * ( mid + 1 ) == b ) { yes = true; break; }
                if ( mid * ( mid + 1 ) > b ) right = mid;
                else left = mid + 1;
            }
            if ( yes ) break;
        }
        if ( yes ) System.out.print( "YES" );
        else System.out.print( "NO" );
    }
}

import java.util.Scanner;

public class A {

	public static void main(String[] args) {
		Scanner theIn=new Scanner(System.in);
		int n=theIn.nextInt();
		int t=(int) Math.sqrt((double) n);
		int left;
		boolean result=false;
		for (int i=1; i<=t; i++) {
			left=(n-i*(i+1)/2)*2;
			int m=(int) Math.floor(Math.sqrt(left));
			if (m==0) continue;
			if (m*(m+1)==left) {
				result=true;
				break;
			}
		}
		if (result) System.out.println("YES");
		else System.out.println("NO");
	}
}

import java.util.*;
import java.io.*;
public class A {

        public static void main (String [] args) {
                Scanner cin = new Scanner(System.in);
                Set<Integer> ok = new HashSet<Integer>();
                for( int i=1 ; i*(i+1)/2 <= 1000000000 ; i ++ ) {
                        ok.add(i*(i+1)/2);
                }
                while( cin.hasNext()){
                        int a = cin.nextInt();
                        String res = "NO" ;
                        for( int j=1; j*(j+1) <= a ; j ++ ) {
                         int tmp= j*(j+1)/2;
                         int rnd = a - tmp;
                         if( ok.contains(rnd) ) {
                             res = "YES";
                             break;
                          }
                        }
                       System.out.println(res);
                }
        }
}

import java.io.*;
import java.util.*;

public class TaskA implements Runnable {
	BufferedReader in;
	PrintWriter out;
	StringTokenizer stok;

	String nextToken() {
		try {
			while (stok == null || !stok.hasMoreTokens()) {
				stok = new StringTokenizer(in.readLine());
			}
		} catch (Exception e) {
			return null;
		}
		return stok.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	long nextLong() {
		return Long.parseLong(nextToken());
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}

	boolean isCool(int x) {
		x *= 2;
		int k = (int)Math.sqrt(x);
		return k * (k + 1) == x;
	}

	void solve() throws IOException {
		ArrayList<Integer> a = new ArrayList<Integer>();
		int n = nextInt(), x;
		for (int i = 1; (x = i * (i + 1) / 2) < n; i++) {
			if (isCool(n - x)) {
				out.println("YES");
				return;
			}
		}
		out.println("NO");
	}

	public void run() {
		try {
			try {
				in = new BufferedReader(new FileReader("taska.in"));
				out = new PrintWriter("taska.out");
			} catch (Exception e1) {
				try {
					in = new BufferedReader(new FileReader("input.txt"));
					out = new PrintWriter("output.txt");
				} catch (Exception e2) {
					in = new BufferedReader(new InputStreamReader(System.in));
					out = new PrintWriter(System.out);
				}
			}
			solve();
			in.close();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) throws IOException {
		try {
			Locale.setDefault(Locale.US);
		} catch (Exception e) {
		}
		new Thread(new TaskA()).start();
	}
}

import java.io.*;
import java.util.*;

public class TaskA {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer stok;

    void solve() throws IOException {
        int n = nextInt();
        if (n == 1) {
            out.println("NO");
            return;
        }
        int l = 1, r = (int) Math.sqrt(2 * n) + 31;
        while (l <= r) {
            while (l * (l + 1) / 2 + r * (r + 1) / 2 > n) {
                r--;
            }
            if (l * (l + 1) / 2 + r * (r + 1) / 2 == n) {
                out.println("YES");
                return;
            }
            l++;
        }
        out.println("NO");
    }

    String nextToken() throws IOException {
        while (stok == null || !stok.hasMoreTokens()) {
            String s = br.readLine();
            if (s == null) {
                return null;
            }
            stok = new StringTokenizer(s);
        }
        return stok.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    char nextChar() throws IOException {
        return (char) (br.read());
    }

    String nextLine() throws IOException {
        return br.readLine();
    }

    void run() throws IOException {
        // br = new BufferedReader(new FileReader("input.txt"));
        // out = new PrintWriter("output.txt");
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        br.close();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        // Locale.setDefault(Locale.US);
        new TaskA().run();
    }
}

import java.util.Scanner;

public class FunkyNumbers192A {

	private static boolean isTriangle(int n) {
		if (n <= 0)
			return false;
		int k = getK(n);
		if (getTriangle(k) == n)
			return true;
		else
			return false;
	}

	private static int getK(long n) {
		int k = (int) ((-1 + Math.sqrt(1 + 8 * n)) / 2);
		return k;
	}

	private static int getTriangle(int k) {
		return k * (k + 1) / 2;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = getK(n) + 1;
		for (int i = 1; i <= m; i++) {
			int t1 = getTriangle(i);
			int t2 = n - t1;
			if (isTriangle(t2)) {
				System.out.println("YES");
				return;
			}
		}
		System.out.println("NO");
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Funky {

	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner(System.in);
		long []x=new long [100001];
		x[1]=1;
		for(int i=2;i<x.length;i++)
			x[i]=x[i-1]+i;
		String ans="NO";
		long n=sc.nextInt();

		for(int i=1;i<x.length;i++)
			if(Arrays.binarySearch(x, n-x[i])>0)
				ans="YES";
		System.out.println(ans);

	}
	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {return Integer.parseInt(next());}

		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

		public boolean ready() throws IOException {return br.ready();}

	}
}

import java.util.*;
import java.io.*;
public class A
{
      public static void main(String ar[]) throws Exception
      {
         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
         int n=Integer.parseInt(br.readLine());
         int u=0;
         HashSet<Integer> hs=new HashSet<Integer>();
         for(int i=1;i<100000;i++)
         {
               long l=(long)i;
               l=(l*(l+1))/2;
               if(l<=1000000000)
                hs.add((int)l);
               else
                break;
         }
         for(int i:hs)
         {
               if(hs.contains(n-i))
                u=1;
         }
         if(u==1)
          System.out.println("YES");
         else
          System.out.println("NO");
      }
}

import java.io.*;
import java.util.*;

public class p192a
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        System.out.println();
        int n = sc.nextInt();
        n *= 2;
        int m = (int)Math.sqrt(n);
        for(int i=1;i<m;i++)
        {
            int a = n-i*i-i;
            int b = (int)Math.sqrt(a);
            if(b*(b+1)==a)
            {
                System.out.print("YES");
                System.exit(0);
            }
        }
        System.out.print("NO");
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.ParseException;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class CF_2 {

	public static void main(String[] args) throws IOException, ParseException {

		// InputReader in = new InputReader(new FileInputStream("input.txt"));
		InputReader in = new InputReader(System.in);

		// BufferedReader br = new BufferedReader(new
		// InputStreamReader(System.in));

		int n = in.nextInt();

		TreeSet<Integer> ts = new TreeSet<>();

		int i = 1;
		int result;

		while ((result = i * (i + 1) / 2) < n) {
			ts.add(result);
			i++;
		}

		boolean b = false;

		for (Integer val : ts) {
			if (ts.contains(n - val)) {
				b = true;
				break;
			}
		}

		System.out.println(b ? "YES" : "NO");

	}

}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by saksham on 11-08-2016.
 * 192A
 */
public class FunkyNumbers {
    public static void main(String []args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int num = Integer.parseInt(br.readLine());
        if(num < 2) {
            System.out.println("NO");
            return;
        }
        int[] arr = new int[50000];
        int i = 0, maxIndex = 0;
        arr[0] = 0;
        for(i = 1; arr[i-1] <= num; i++) {
            arr[i] = arr[i-1] + i;
            maxIndex = i;
        }
        maxIndex--;
        while(maxIndex > 0) {
            i = 1;
            while ((arr[i] + arr[maxIndex] <= num) && i <= maxIndex) {
                if (arr[i] + arr[maxIndex] == num) {
                    System.out.println("YES");
                    return;
                }
                i++;
            }
            maxIndex--;
        }
        System.out.println("NO");
    }
}

import java.util.*;
import java.io.*;
import java.math.*;
import java.awt.*;
public class FunkyNumbers
{
    static final int INF = Integer.MAX_VALUE;
    static final int NINF = Integer.MIN_VALUE;

    public static void main(String[]args)throws IOException
    {
        Input in = new Input();
        int n = in.nextInt();
        ArrayList<Integer> tris = new ArrayList<Integer>();
        int i = 1;
        while(i*(i+1)/2 <= 1000000000)
        {
            tris.add(i*(i+1)/2);
            i++;
        }

        Integer [] arr = tris.toArray(new Integer[0]);

        for(i = 0; i < arr.length; i++)
        {
            if(Arrays.binarySearch(arr, n-arr[i]) >= 0)
            {
                System.out.println("YES");
                exit();
            }
        }
        System.out.println("NO");
    }

    public static void exit()
    {
        System.exit(0);
    }
}

class Input
{
    BufferedReader br;
    StringTokenizer st;

    public Input()
    {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    public String nextLine()throws IOException
    {
        StringBuilder sb = new StringBuilder();
        if(st == null)
            st = new StringTokenizer(br.readLine());
        if(!st.hasMoreTokens())
        {
            st = new StringTokenizer(br.readLine());
            return "";
        }

        while(st.hasMoreTokens())
        {
            sb = sb.append(st.nextToken());
            if(st.hasMoreTokens())
              sb = sb.append(" ");
        }
        st = new StringTokenizer(br.readLine());
        return sb.toString();
    }

    public int nextInt()throws IOException
    {
        return Integer.parseInt(next());
    }

    public long nextLong()throws IOException
    {
        return Long.parseLong(next());
    }

    public float nextFloat()throws IOException
    {
        return Float.parseFloat(next());
    }

    public double nextDouble()throws IOException
    {
        return Double.parseDouble(next());
    }

    public String next()throws IOException
    {
        if(st == null || !st.hasMoreTokens())
          st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }
}

public class Main
{
    public static void main (String[]args)
    {
        java.util.Scanner inp = new java.util.Scanner(System.in);
        int x = inp.nextInt();
        int y = 2 * x;
        int f = (int)Math.sqrt(y);
        for(int i = 1;i <= f;i++){
            if(((i*(i+1))+(i * (i+1))) > (y))
            break;
            for(long k = f;k >= i;k--){
                if(((i*(i+1))+(k * (k+1))) < y ){
                    break;
                }
                if( (y) == ((i*(i+1))+(k * (k+1)))){
                    System.out.println("YES");
                    System.exit(0);
                }
            }
        }
        System.out.println("NO");

    }
}

//package Round_121;

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class a {

    void solve() throws Exception {
        int n = in.nextInt();

        HashSet<Long> hash = new HashSet<Long>();
        long sum = 0;
        for (long i = 1; sum <= (int)1e9 + 1; i++){
            sum += i;
            hash.add(sum);
        }

        for (long x : hash){
            if (hash.contains(n - x)){
                out.println("YES");
                return;
            }
        }
        out.println("NO");

    }

    FastScanner in;
    PrintWriter out;

    String input = "";
    String output = "";

    void run() {
        try {
            if (input.length() > 0) {
                in = new FastScanner(new BufferedReader(new FileReader(input)));
            } else
                in = new FastScanner(new BufferedReader(new InputStreamReader(
                        System.in)));
            if (output.length() > 0)
                out = new PrintWriter(new FileWriter(output));
            else
                out = new PrintWriter(System.out);

            solve();

            out.flush();
            out.close();
        } catch (Exception ex) {
            ex.printStackTrace();
            out.flush();
            out.close();
        } finally {
            out.close();
        }
    }

    public static void main(String[] args) {
        new a().run();
    }

    class FastScanner {
        BufferedReader bf;
        StringTokenizer st;

        public FastScanner(BufferedReader bf) {
            this.bf = bf;
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(bf.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public String nextLine() throws IOException {
            return bf.readLine();
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public int[] readIntArray(int n) throws IOException {
            int[] array = new int[n];
            for (int i = 0; i < n; i++)
                array[i] = this.nextInt();
            return array;
        }

        public long[] readLongArray(int n) throws IOException {
            long[] array = new long[n];
            for (int i = 0; i < n; i++)
                array[i] = this.nextLong();
            return array;
        }

    }

}

import java.util.Scanner;

/**
 * Created by Rain on 25/12/13.
 */
public class A192 {
    public static int md=44722;
    public static int s[]=new int[md+100];
    public static boolean check(int x)
    {
        int l=1,r=44722;
        while (l<=r)
        {
            int mid=(l+r)/2;
            if (s[mid]==x) return true;
            if (s[mid]>x) r=mid-1;
            else l=mid+1;
        }
        return false;
    }
    public static void main(String[] args)
    {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        for (int i=1; i<=md;i++)
        {
          //  long x=i;
            s[i]=(int)((long)i*(i+1))/2;
        }
        for (int i=1; i<=md;i++)
        if (n>s[i] && check (n-s[i]))
        {
            System.out.println("YES");
            return;
        }
        System.out.println("NO");

    }
}

import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class FunkyNumbers implements Closeable {

    private InputReader in = new InputReader(System.in);
    private PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out), true);

    public void solve() {
        int n = in.ni();
        Set<Integer> set = new HashSet<>();
        int[] seed = new int[60000];
        for (int i = 1; i <= 60000; i++) {
            set.add(seed[i - 1] = (int)((long) i * (i + 1) / 2));
        }
        for (int i = 0; i < 60000; i++) {
            if (set.contains(n - seed[i])) {
                out.println("YES");
                return;
            }
        }
        out.println("NO");
    }

    @Override
    public void close() throws IOException {
        in.close();
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ni() {
            return Integer.parseInt(next());
        }

        public long nl() {
            return Long.parseLong(next());
        }

        public void close() throws IOException {
            reader.close();
        }
    }

    public static void main(String[] args) {
        new FunkyNumbers().solve();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

public class A {

	private void solve() throws IOException {
		long n = nextLong();
		HashSet<Long> H = new HashSet<Long>();
		for (long i = 1; i < 100000; i++) {
			H.add(i * (i + 1) / 2);
		}
		for (long i = 1; i < 100000; i++) {
			long t = i * (i + 1) / 2;
			long tt = n - t;
			if (H.contains(t) && H.contains(tt)) {
				pl("YES");
				return;
			}
		}
		pl("NO");
	}

	public static void main(String[] args) {
		new A().run();
	}

	BufferedReader reader;
	StringTokenizer tokenizer;
	PrintWriter writer;

	public void run() {
		try {
			reader = new BufferedReader(new InputStreamReader(System.in));
			tokenizer = null;
			writer = new PrintWriter(System.out);
			solve();
			reader.close();
			writer.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	BigInteger nextBigInteger() throws IOException {
		return new BigInteger(nextToken());
	}

	String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}

	void p(Object... objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.flush();
			writer.print(objects[i]);
			writer.flush();
		}
	}

	void pl(Object... objects) {
		p(objects);
		writer.flush();
		writer.println();
		writer.flush();
	}

	int cc;

	void pf() {
		writer.printf("Case #%d: ", ++cc);
		writer.flush();
	}

}

import java.util.*;

public class Funky{
	public static String solve(int n){
		int m = 2*n;
		for(int i = 1; i < Math.sqrt(n); i++){
			int x = m-i*(i+1);
			int y = (int)Math.floor(Math.sqrt(x));
			if( x == y*(y+1) ){
				return "YES";
			}
		}
		return "NO";
	}

	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);

		int n = stdIn.nextInt();
		System.out.println(solve(n));

	}
}

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner r = new Scanner(System.in);

        long N = r.nextLong();

        ArrayList<Long> a = new ArrayList<Long>();

        for(long k = 1; ;k++){
            if(k * ( k + 1 ) / 2 >= N)break;
            a.add(k * (k + 1) / 2);
        }

        for(int i = 0; i < a.size(); i++){
            long rem = N - a.get(i);

            if(rem <= 0)continue;

            int ret = Collections.binarySearch(a, rem);
            if(ret >= 0){
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}

public class Main{
	public static void main(String[]args){
		java.util.Scanner input = new java.util.Scanner(System.in);
		int x = input.nextInt() * 2;
		int m = (int)Math.sqrt(x);
		for(int i = 1; i < m; i++){
			int a = x - i * i - i;
			int b = (int)Math.sqrt(a);
			if(b * (b + 1) == a){
				System.out.print("YES");
				System.exit(0);
			}
		}
		System.out.print("NO");
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class A_Div2_121 {
    public static void main(String[]arg) throws IOException
    {
        new A_Div2_121().solve();
    }
    public void solve()throws IOException
    {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        long n,a,b;
        int c;
        //tn = triangular numbers
        long[]tn = new long[44720];
        c = 0;
        for(a = 1, b = 2; a < 1000000001; a += b, b++)
            tn[c++] = a;
        boolean end = false;
        c = 0;
        n = Integer.parseInt(in.readLine());
        while(!end && c != -1 && c < 44720)
        {
            a = tn[c++];
            if(n - a < 0)
                c = -1;
            else
            {
                b = n - a;
                if(Arrays.binarySearch(tn, b) > -1)
                    end = true;
            }
        }
        //System.out.println(a + "##" + b);
        if(end)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		ArrayList<Long> l = new ArrayList<Long>();
		for (long k = 1; k <= 44720; k++)
			l.add(k * (k + 1) / 2);
		HashSet<Long> set = new HashSet<Long>(l);

		int n = new Scanner(System.in).nextInt();
		for(int i = 0; i < l.size() && l.get(i) < n; i++)
			if(set.contains(n - l.get(i))){
				System.out.println("YES");
				System.exit(0);
			}
		System.out.println("NO");
	}
}

import java.util.Scanner;

public class A121div2 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long n2 = 2*n;
		boolean b = false;
		for (long i = 1; i*i + i < n2; i++) {
			long r = n2 - (i*i + i);
			long D = 1 + 4*r;
			long sd = (long)Math.sqrt(D);
			if(sd*sd == D) {
				long t = -1 + sd;
				if(t % 2 == 0) {
					b = true;
					break;
				}
			}
		}
		System.out.println(b ? "YES" : "NO");
	}

}

import java.util.Scanner;
import java.util.Arrays;
public class Ishu
{
	static boolean srch(int[] a, int x)
	{
	int beg=(int)(Math.floor(Math.sqrt(2*x)-1)),end=(int)(Math.ceil(Math.sqrt(2*x)-1));
	int mid;
	while(beg<=end)
		{
		mid=(beg+end)/2;
		if(a[mid]<x)
			beg=mid+1;
		else if(a[mid]>x)
			end=mid-1;
		else
			return true;
		}
	return false;
	}
	public static void main(String[] args)
	{
	Scanner scan=new Scanner(System.in);
	int n,i;
	int[] a=new int[100000];
	a[0]=1;
	for(i=1;i<100000;++i)
		a[i]=i+1+a[i-1];
	n=scan.nextInt();
	for(i=0;a[i]<=n/2;++i)
		{
		if(srch(a,n-a[i]))
			break;
		}
	if(a[i]<=n/2)
		System.out.println("YES");
	else
		System.out.println("NO");
	}
}

import java.util.Scanner;
public class Main {
    public static void main (String[]args) {
        Scanner in = new Scanner(System.in);
        int x = in.nextInt();
        int n[] = new int[44721];

        //if (x == 1) {
        //  System.out.println("NO");
        //} else {
            for (int i = 0 ; i < 44720; i++) {
                n[i] = (i+1)*(i+2);
            }
            /*for (int i = 0 ; i < 100; i++) {
                System.out.println(n[i]);
            }*/
            int q = -1;
            for (int i = 0; i < 44721 && ( ((x*2) - n[i]) > 0 ); i++) {
                q = BinarySearch (n, ((x*2) - n[i]));
                //System.out.println("q = "+q);
                if (q != -1) {
                    System.out.println("YES");
                    break;
                }
            }
            if (q == -1) {
                System.out.println("NO");
            }
            //System.out.println( q == -1 ? "NO" : "YES");
        //}
    }

    public static int BinarySearch (int[] a, int key) {
        //Note: The input array must be sorted.
        int lo = 0;
        int hi = a.length;
        int mid;
        while (lo < hi) {
            mid = (lo+hi)/2;
            if (key < a[mid]) hi = mid;
            else if (key > a[mid]) lo = mid+1;
            else return mid;
        }
        return -1;
    }//binary search method end
}

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Iterator;

public class Main {

    /** GENERAL CONFIGURATION **/
    public static final int TIME_LIMIT = 2;
    public static final long MEMORY_LIMIT = 64 * 1024 * 1000;
    public static final int INPUT_OUTPUT = InputOutputMode.CONSOLE;

    /** EXTENDS CONFIGURATION **/
    public static final String INPUT_FILE_NAME = "input.txt";
    public static final String OUTPUT_FILE_NAME = "output.txt";

    /** INITIALIZATION  IO **/
    public static final InputReader in = Prepare.input();
    public static final OutputWriter out = Prepare.output();

    public static void main(String[] args) throws IOException {
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {
    ArrayList[]start = new ArrayList[26];
    char begin;
    char finish;
    int MAX = 0;

    public void solve(int testNumber, InputReader in, OutputWriter out) {
          int n = in.readInt();
            HashSet<Long>set = new HashSet<Long>();
            for (long i = 2;; i++) {
                long x = (long)(i * i);
                if (x > 8000000001L) break;
                else {
                    set.add(x);
                }
            }

            Iterator<Long>it = set.iterator();
            while (it.hasNext()) {
                long t = it.next();
                long x = (t - 1) / 8;
                if (x * 8 + 1 != t) continue;
                long b = 8 * (n - x) + 1;
                if (set.contains(b) && n - x > 0 && x > 0) {
                    out.printLine("YES");
                    return;
                }
            }
            out.printLine("NO");

    }

    public int start(int id, int s, int e, int len) {
        if ('a' + e == begin) MAX = Math.max(MAX, len);
        for (int j = 0; j < start[e].size(); j++) {
            King k = (King)start[e].get(j);
            if (k.id > id) {
                start(k.id, k.start - 'a', k.end - 'a', len + k.len);
            }
        }
        return len;
    }

    class King {
        int id;
        char start;
        char end;
        int len;
        public King(int id, char s, char e, int len) {
            this.id = id;
            start = s;
            end = e;
            this.len = len;
        }
    }
}

class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuffer res = new StringBuffer();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public char readCharacter() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        return (char) c;
    }

    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }
}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(outputStream);
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }
}

class InputOutputMode {
    public static final int CONSOLE = 0;
    public static final int FILE = 1;
}

class Prepare {
    public static InputStream input;
    public static OutputStream output;

    @SuppressWarnings("unused")
    public static InputReader input() {
        try {
            if (Main.INPUT_OUTPUT == InputOutputMode.CONSOLE) {
                input = System.in;
            }
            else if (Main.INPUT_OUTPUT == InputOutputMode.FILE){
                input = new FileInputStream(new File(Main.INPUT_FILE_NAME));
            }
        }
        catch (IOException ex)
        {
            System.err.println("Some problem with input settings.");
            System.exit(0);
        }
        return new InputReader(input);
    }
    @SuppressWarnings("unused")
    public static OutputWriter output() {
        try {
            if (Main.INPUT_OUTPUT == InputOutputMode.CONSOLE) {
                output = System.out;
            }
            else if (Main.INPUT_OUTPUT == InputOutputMode.FILE){
                output = new FileOutputStream(new File(Main.OUTPUT_FILE_NAME));
            }
        }
        catch (IOException ex) {
            System.err.println("Some problem with output settings.");
            System.exit(0);
        }
        return new OutputWriter(output);
    }
}

import java.math.BigInteger;
import java.util.*;
public class hhahah {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n= sc.nextInt(); boolean f =false ;
		int ans[]= new int[44721];
		int j = 0 ;
			for(int i=1;i<=44722;i++)

			{
				int c=(int)(Math.sqrt((n-(i*(i+1)/2))*2));
				if(c*(c+1)/2 + i*(i+1)/2 ==n && c!=0)
				{
					f=true ; break ;

				}

			}
			//if(n==1)f=false ;
		System.out.println(f?"Yes":"No");

	}

	public static boolean ispalin(String x){
		if(x.length()==0 || x.length()==1)
			return true ;
		if(x.charAt(0)!=x.charAt(x.length()-1))
			return false ;
		return ispalin(x.substring(1, x.length()-1));

	}

}

import java.io.*;
import java.util.*;
import java.math.*;

public class Main
{
	BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	StringTokenizer tokenizer=null;

	public static void main(String[] args) throws IOException
	{
		new Main().execute();
	}

	void debug(Object...os)
	{
		System.out.println(Arrays.deepToString(os));
	}

	int ni() throws IOException
	{
		return Integer.parseInt(ns());
	}

	long nl() throws IOException
	{
		return Long.parseLong(ns());
	}

	double nd() throws IOException
	{
		return Double.parseDouble(ns());
	}

	String ns() throws IOException
	{
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(br.readLine());
		return tokenizer.nextToken();
	}

	String nline() throws IOException
	{
		tokenizer=null;
		return br.readLine();
	}

	//Main Code starts Here
	int totalCases, testNum;
	long n;
	int MAXN = 1000000;

	void execute() throws IOException
	{
		totalCases = 1;
		for(testNum = 1; testNum <= totalCases; testNum++)
		{
			if(!input())
				break;
			solve();
		}
	}

	void solve() throws IOException
	{
		boolean poss = false;
		for(int i = 1;i<MAXN;i++)
		{
			long a = (i*(long)(i+1))/2;
			long b = n-a;
			if(triangular(b))
			{
				//debug(a,b,i);
				poss = true;
				break;
			}
		}
		if(poss)
			System.out.println("YES");
		else
			System.out.println("NO");

	}

	boolean triangular(long x)
	{
		boolean trai = false;
		if(x>0)
		{
			long a = (long)Math.sqrt(1+8*x);
			if(a*a == 1+8*x)
			{
				long b = (a-1);
				if(b>0 && b%2 == 0)
					trai = true;
			}
		}
		return trai;
	}

	boolean input() throws IOException
	{
		n = nl();
		return true;
	}

}

//package codeforces;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.StreamTokenizer;
import java.util.ArrayList;

public class CodeForces {

    ArrayList<Integer> num = new ArrayList<Integer>();

    private boolean search(int value, int begin, int end) {
        if (end - begin < 3) {
            if (num.get(begin) == value || num.get(end) == value) {
                return (true);
            } else {
                return (false);
            }
        } else {
            int middle = (end - begin) / 2 + begin;
            if (num.get(middle) == value) {
                return (true);
            } else {
                if (num.get(middle) < value) {
                    return (search(value, middle + 1, end));
                } else {
                    return (search(value, begin, middle - 1));
                }
            }
        }
    }

    public void run() throws IOException {
        MyScanner sc = new MyScanner(System.in);
        int n = sc.nextInt();
        int i = 1;
        boolean greater = false;
        while (!greater) {
            long number = i * (i + 1) / 2;
            if (number >= n) {
                greater = true;
            } else {
                num.add((int) number);
            }
            i++;
        }
        boolean exist = false;
        for (i = 0; i < num.size(); i++) {
            if (search(n - num.get(i), 0, num.size() - 1)) {
                exist = true;
                break;
            }
        }
        if (exist) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

    public static void main(String[] args) throws FileNotFoundException, IOException {
        CodeForces cf = new CodeForces();
        cf.run();
    }
}

class MyScanner {

    private StreamTokenizer st;

    public MyScanner(InputStream is) {
        st = new StreamTokenizer(is);
    }

    public MyScanner(File f) throws FileNotFoundException {
        BufferedReader in = new BufferedReader(new FileReader(f));
        st = new StreamTokenizer(in);
    }

    public int nextInt() throws IOException {
        st.nextToken();
        return ((int) st.nval);
    }

    public double nextDouble() throws IOException {
        st.nextToken();
        return (st.nval);
    }

    public String nextString() throws IOException {
        st.nextToken();
        return (st.sval);
    }
}

import java.util.ArrayList;

import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;
import java.util.Vector;

public class Sourcecode {
    public static void main(String[] args) {

     Scanner input = new Scanner(System.in);
     int num=input.nextInt();
     int result=getanswer(num);
     if(result==1){
     System.out.println("YES");}
     else{
         System.out.println("NO");
     }
    }

    private static int getanswer(int num) {
        int sum=num*2;
        for(int i=1;i<=Math.sqrt(sum);i++){
            for(int j=(int) Math.sqrt(sum-i*(i+1));j>=i;j--){
                if(j*(j+1)+i*(i+1)==sum){
                    return 1;
                }

            }
        }
        return 0;
    }

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.HashSet;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        HashSet<Integer> hs = new HashSet<Integer>();
        for(int i = 1;(i*(i+1))/2 <= (int)1e9;i++) {
           hs.add(i*(i+1)/2);
        }
        for(int i = 1;i*i <= n;i++) {
            int v = n -(i*(i+1)/2);
            if(hs.contains(v)){
                out.println("YES");
                return;
            }
        }
        out.println("NO");

    }

}

class InputReader {
    private BufferedReader br;
    private StringTokenizer st;
    public InputReader(InputStream in) {
        br=new BufferedReader(new InputStreamReader(in));
        try {
            st=new StringTokenizer(br.readLine());
        } catch (IOException ignored) {

        }
    }

    public int nextInt(){
        return Integer.parseInt(st.nextToken());
    }

}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;

public class FunkyNumbers {

    void run() {
        try {
            BufferedReader bfd = new BufferedReader(new InputStreamReader(
                    System.in));
            int n = Integer.parseInt(bfd.readLine()), i = 1, x;
            Collection<Integer> ts = new HashSet<Integer>();
            while(true) {
                x =i*(i+1)/2;
                if(x>n) break;
                ts.add(x);
                ++i;
            }
            ArrayList<Integer> list = new ArrayList<Integer>();
            list.addAll(ts);
            boolean ok = false;
            for(i=0; i<list.size(); ++i)
                if(ts.contains(n - list.get(i)))
                    ok = true;
            if(ok) System.out.println("YES");
            else System.out.println("NO");
        } catch (Exception e) {

        }
    }
    public static void main(String[] args) {
        new FunkyNumbers().run();
    }

}

import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class Tests{
	static Scanner in = new Scanner (System.in);
	static PrintWriter out = new PrintWriter (System.out);
	static int arr [] = new int [60004];
	static HashSet <Integer> list = new HashSet <Integer>();

	public static void main (String []args) {

		int n = in.nextInt();

		for(int i = 1; i <= 60000; ++i){
			arr[i-1] = (int)((long) i*(i + 1) / 2);
			list.add(arr[i-1]);
		}

		for(int i = 0; i < 60000; ++i){
			if(list.contains(n - arr[i]))
			{
				out.println("YES");
				out.flush();
				System.exit(0);
			}
		}
		out.println("NO");

		out.flush();
		out.close();

	}

}

import java.util.Arrays;
import java.util.Scanner;

public class P_192_A_FunkyNumbers {

    static long []arr=new long[100000];
    public static void main(String[] args) {

        init();
        Scanner x=new Scanner(System.in);
        long n=x.nextLong();

        for(int i=0;arr[i]<n;i++)
        {
            if(Arrays.binarySearch(arr, n-arr[i])>=0)
            {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
        return;

    }
    private static void init() {

        for(int i=1;i<100000;i++)
            arr[i-1]=(long)(i)*(i+1)/2;

    }

}

import java.io.*;
import java.util.*;

public class CF_192_A_FUNKY_NUMBERS {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		int len = (int) 5e4;
		HashSet<Integer> set = new HashSet<>();
		int[] freq = new int[len + 1];

		for (int i = 1; i <= len; i++)
			set.add(freq[i] = (int) ((1l * i * ((1l * i) + 1l)) >> 1l));

		for (int i = 1; i <= len && (n - freq[i] >= 0); i++)
			if (set.contains((n - freq[i]))) {
				System.out.println("YES");
				return;
			}

		System.out.println("NO");
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

}

import java.util.*;
import java.io.*;

public class Main{

    public void run(){
	Scanner in = new Scanner(System.in);
	int n = in.nextInt();
	n*=2;
	for(int i=1;i*i<=n;i++){
	    int k = n - i*(i+1);
	    int t = (int)Math.sqrt(k);
	    if (t == 0) continue;
	    if (t * (t + 1) == k){
		System.out.println("YES");
		return;
	    }
	}
	System.out.println("NO");
    }

    public static void main(String args[]){
	new Main().run();
    }
}

import java.util.*;
import java.io.*;
public class Main{
  public static void main(String[] args) {
    Scanner in=new Scanner(System.in);
    int arr[]=new int[44760];
    int i,j;
    for(i=0;i<44760;i++){
      arr[i]=((i+1)*(i+2))/2;
    }
    int n=in.nextInt();
    for(i=0;i<44760;i++){
      if(arr[i]>n){
        System.out.println("NO");
        return;
      }
      if(Arrays.binarySearch(arr,n-arr[i])>=0){
        System.out.println("YES");
        return;
      }
    }
    System.out.println("NO");
  }
}

import java.util.*;

public class Airport {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
         Map<Integer,Integer> triangle = new TreeMap<>();
       Scanner s= new Scanner(System.in);
       int n = s.nextInt();
       ArrayList<Integer> num = new ArrayList<>();
       int cur=0;
       for(int i=1;cur<n;i++) {
           cur+=i;
            num.add(cur);
            triangle.put(cur,1);
        }
       for(int i=0;i<num.size();i++)
       {
           if(triangle.get(n-num.get(i))!=null){ System.out.println("YES");System.exit(0); }
       }
       System.out.println("NO");
    }
}

import java.util.Scanner;

public class ACM
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        n *= 2;
        int k = (int)Math.round(Math.sqrt(n));
        boolean found = false;
        for (int i = 1; i < k; i ++)
        {
            int r = n - i * i - i;
            int x = (int)Math.sqrt(r);
            if (x * (x + 1) == r)
            {
                found = true;
                break;
            }
        }
        if (found)
        {
            System.out.println("YES");
        }
        else
        {
            System.out.println("NO");
        }
    }
}

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner t = new Scanner(System.in);
        int numero = t.nextInt();
        if (IsFunky(numero)) System.out.println("YES");
        else System.out.println("NO");
    }

    static boolean IsFunky(int n){
        if (n <= 1) return  false;
        List<Integer> Triangulares;
        Triangulares = Get_Triangulares(n);
        return BusquedaBinaria(Triangulares, n);
    }

    static boolean BusquedaBinaria(List<Integer> Lista, int dato){
        int izquierda = 0, derecha = Lista.size() - 1, mitad;
        while (izquierda <= derecha){
            //mitad = (izquierda + derecha)/2;
            //System.out.println(Lista.get(izquierda) + " + " + Lista.get(derecha) + " = " + (Lista.get(izquierda)+Lista.get(derecha)));
            if (Lista.get(izquierda) + Lista.get(derecha) == dato) return true;
            else if (Lista.get(izquierda) + Lista.get(derecha) > dato) derecha--;
            else izquierda++;
        }
        return false;
    }

    static List Get_Triangulares(int n){
        List<Integer> Lista = new ArrayList<>();
        for (int i = 1, j = 0; n > Num_Trian(i); i++, j++) Lista.add(Num_Trian(i));
        //for (int i = 0; i < Lista.size(); i++) System.out.print(Lista.get(i) + ", ");
        return Lista;
    }

    static int Num_Trian(int n){
        return (n*(n+1))/2;
    }
}

import java.util.Scanner;

public class A {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if (n == 1){
            System.out.println("NO");
            return;
        }
        for (int i = 1; i <=Math.sqrt(2*n); i++) {
            int t = 2*n-i*(i+1);
            int x = (int)Math.sqrt(t);
            if (t == x*(x+1) && t != 0){
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

//import for Scanner and other utility classes
import java.util.*;

public class funky {

    public static void main(String args[] ) throws Exception {

         InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
InputReader sc = new InputReader(inputStream);
int n=sc.nextInt();
int vals[]=new int[44720];
for(int k=0;k<44720;k++){
  int i=k+1;
  vals[k]=(i*(i+1))/2;
 // System.out.println("arr: "+arr[i-1]+"i: "+i);
}

    for (int i=0;i < 44720;++i)
    {

      if (vals[i] > n)
      {
        System.out.println("NO");
        return;
      }

      if (Arrays.binarySearch(vals, n - vals[i]) >= 0)
      {
        System.out.println("YES");
        return;
      }
    }

    System.out.println("NO");
out.close();

  }
  static class InputReader {
      public BufferedReader reader;
      public StringTokenizer tokenizer;

      public InputReader(InputStream stream) {
          reader = new BufferedReader(new InputStreamReader(stream), 32768);
          tokenizer = null;
      }

      public String next() {
          while (tokenizer == null || !tokenizer.hasMoreTokens()) {
              try {
                  tokenizer = new StringTokenizer(reader.readLine());
              } catch (IOException e) {
                  throw new RuntimeException(e);
              }
          }
          return tokenizer.nextToken();
      }

      public int nextInt() {
          return Integer.parseInt(next());
      }

      public long nextLong()
      {
        return Long.parseLong(next());
      }

  }
 }

import java.util.HashSet;
import java.util.Scanner;
import java.util.Vector;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author KHALED
 */
public class FunkyNumbers {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        HashSet <Integer> hash = new HashSet <Integer> ();
        int i=0;
        while(true)
        {
            i++;
            int k=i*(i+1)/2;
            if(k>n)
                break;
            hash.add(k);
            int h=n-k;
            if(hash.contains(h))
            {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}

import java.util.Scanner;
public class Main {
    public static void main (String[]args) {
        Scanner in = new Scanner(System.in);
        int x = in.nextInt();
        int n[] = new int[44721];

        //if (x == 1) {
        //  System.out.println("NO");
        //} else {
            for (int i = 0 ; i < 44720; i++) {
                n[i] = (i+1)*(i+2);
            }
            /*for (int i = 0 ; i < 100; i++) {
                System.out.println(n[i]);
            }*/
            int q = -1;
            for (int i = 0; i < 44721 && ( ((x*2) - n[i]) > 0 ); i++) {
                q = BinarySearch (n, ((x*2) - n[i]));
                //System.out.println("q = "+q);
                if (q != -1) {
                    System.out.println("YES");
                    break;
                }
            }
            if (q == -1) {
                System.out.println("NO");
            }
            //System.out.println( q == -1 ? "NO" : "YES");
        //}
    }

    public static int BinarySearch (int[] a, int key) {
        //Note: The input array must be sorted.
        int lo = 0;
        int hi = a.length;
        int mid;
        while (lo < hi) {
            mid = (lo+hi)/2;
            if (key < a[mid]) hi = mid;
            else if (key > a[mid]) lo = mid+1;
            else return mid;
        }
        return -1;
    }//binary search method end
}

import java.util.*;
public class Maim{
    public static void main(String[]args){
        Scanner input = new Scanner(System.in);

        long n = input.nextInt();
        if(isCool(n))
            System.out.println("YES");
        else
            System.out.println("NO");
    }
    public static boolean isCool(long n){
        long x = 2;
        for(long i = 1; i <= n/2; i += x++){
            double d = (Math.sqrt(8 * (n - i) + 1) - 1)/2;
            double f = d - (long)d;
            if(f == 0){
                return true;
            }
        }
        return false;
    }

}

import java.util.Arrays;
import java.util.Scanner;

public class Prob192A {
	public static void main(String[] Args) {
		Scanner in = new Scanner(System.in);
		int terms = (int) Math.sqrt(2000000000);
		int[] array = new int[terms + 3];
		for (int i = 0; i < array.length; i++)
			array[i] = (i + 1) * (i + 2) / 2;

		int number = in.nextInt();
		boolean ok = false;
		for (int i = 0; i < array.length; i++)
			if (Arrays.binarySearch(array, number - array[i]) >= 0)
				ok = true;

		System.out.println(ok ? "YES" : "NO");
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class A_Div2_121 {
    public static void main(String[]arg) throws IOException
    {
        new A_Div2_121().solve();
    }
    public void solve()throws IOException
    {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        long n,a,b;
        int c;
        //tn = triangular numbers
        long[]tn = new long[44720];
        c = 0;
        for(a = 1, b = 2; a < 1000000001; a += b, b++)
            tn[c++] = a;
        boolean end = false;
        c = 0;
        n = Integer.parseInt(in.readLine());
        while(!end && c != -1 && c < 44720)
        {
            a = tn[c++];
            if(n - a < 0)
                c = -1;
            else
            {
                b = n - a;
                if(Arrays.binarySearch(tn, b) > -1)
                    end = true;
            }
        }
        //System.out.println(a + "##" + b);
        if(end)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;

public class App {

    public static void main(String[] args) throws IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(
                System.in));
        BigInteger long1 = new BigInteger(reader.readLine());
        ArrayList<BigInteger> integers = new ArrayList<BigInteger>();
        final BigInteger MAX_VALUE = BigInteger.valueOf(1000000000L);
        for (long i = 1;; i++) {
            BigInteger integer = BigInteger.valueOf(i)
                    .multiply(BigInteger.valueOf(i + 1))
                    .divide(BigInteger.valueOf(2));
            if (integer.compareTo(MAX_VALUE) == 1) {
                break;
            }
            integers.add(integer);
        }
        int index = Collections.binarySearch(integers, (long1));
        index = Math.abs(index) + 2 >= integers.size() ? integers.size() - 1
                : Math.abs(index) + 2;
        for (int i = 0; i <= index; i++) {
            BigInteger integer = long1.subtract(integers.get(i));
            int index2 = Collections.binarySearch(integers, integer);
            if (index2 >= 0) {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");

    }
}

import java.util.*;

public class FunkyNumbers {

    public static void main(String[] args) {
        String line = null;
        int n = 0;
        try {
            java.io.BufferedReader br = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
            line = br.readLine();
            String[] nums = line.split(" ");
            n = Integer.parseInt(nums[0]);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        HashSet<Long> vals = new HashSet<Long>();
        boolean found = false;
        for(long k=1;k*(k+1)/2<n;k++){
            long val = k*(k+1)/2;
            vals.add(k*(k+1)/2);
            if(vals.contains(n-val)){
                found = true;
                break;
            }
        }
        if(found){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }

    }

}

import java.util.*;

public class funkynumbers {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub

    Scanner scan=new Scanner(System.in);
    long k=scan.nextInt();

    for(int i=1;i<=50000;i++)
    {
        long n=2*k-i*(i+1);
        long low=0,high=50000,mid=(low+high)/2;
        if(n>0)
        {
            while(low<high && low!=high-1)
            {
                if(mid*(mid+1)<n)
                    low=mid;
                if(mid*(mid+1)>n)
                    high=mid;
                if(mid*(mid+1)==n)
                {
                    System.out.println("YES");
                    System.exit(0);
                }
                mid=(low+high)/2;
            }
        }
        else
            break;
    }

System.out.println("NO");
}

}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
//package pkg121_a;

/**
 * 121_A
 *
 * @author xerxes
 * 9:33:48 PM  May 27, 2012
 * I have not failed, I have just found 10000 ways that won't work.
 */
import java.io.*;
import java.awt.*;
import java.text.*;
import java.math.*;
import java.util.*;
import java.lang.*;

public class Main implements Runnable {

    final String filename = "in";

    public static void main(String[] args) {
        // new Thread(new Main()).start();
        new Thread(null, new Main(), "1", 1 << 25).start();

    }

    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new BufferedWriter(new OutputStreamWriter(System.out));
            //in = new BufferedReader(new FileReader(filename + ".in"));
            // out = new BufferedWriter(new FileWriter(filename+".out"));
            int kase = 1;//iread();
            for (int i = 1; i <= kase; ++i) {
                //TODO CODE HERE
                solve(i);
            }
            out.flush();
        } catch (Exception e) {
            System.exit(1);
        }
    }
    final long maxn = 1000000000 *2;
    public void solve(int kaseno) throws Exception {
        //out.write("Case " + kaseno + ": ");
        TreeSet<Long> numbers = new TreeSet<Long>();
        for(long number=1; ;++number){
            long num = number*(number+1);
            if(num>maxn)break;
            numbers.add(num);
        }
        long N = lread()*2;
        //out.write( numbers.size()+"\n" );
        for( Long e : numbers ){
            long baki = N-e;
            if(baki<0)break;
            if( numbers.contains(baki)==true ){
                out.write("YES\n");
                return ;
            }
        }
        out.write("NO\n");
    }

    public void debug(Object... o) {
        System.err.println(Arrays.deepToString(o));
    }

    public int iread() throws Exception {
        return Integer.parseInt(readword());
    }

    public double dread() throws Exception {
        return Double.parseDouble(readword());
    }

    public long lread() throws Exception {
        return Long.parseLong(readword());
    }
    BufferedReader in;
    BufferedWriter out;

    public String readword() throws IOException {
        StringBuilder b = new StringBuilder();
        int c;
        c = in.read();
        while (c >= 0 && c <= ' ') {
            c = in.read();
        }
        if (c < 0) {
            return "";
        }
        while (c > ' ') {
            b.append((char) c);
            c = in.read();
        }
        return b.toString();
    }
}

import java.util.*;

public class Main111 {
    public static void main(String[] args) {

        Scanner in = new Scanner (System.in);

        int n=in.nextInt();

        ArrayList<Integer> list = new ArrayList<>();
        list.add(1);

        for (int i = 1; i <=n; i++)
        {
            int x=list.get(i-1)+(i+1);
            if(x>n)break;
            list.add(x);
        }

        int i=0,j=list.size()-1;
        while(i<list.size())
        {
            while(list.get(i)+list.get(j)>n&&j>0)j--;
            if(list.get(i)+list.get(j)==n)
            {
                System.out.println("YES");
                return;
            }
            i++;
        }

        System.out.println("NO");

    }

}

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Funky_Numbers {

    public static void main(String[] args) throws FileNotFoundException {
        // TODO Auto-generated method stub
    //long  num=(new Scanner(new FileInputStream("E:\\Eclipse\\workspace\\Codeforces\\src\\input.txt"))).nextLong();
    long  num=(new Scanner(System.in)).nextLong();
    boolean present= false;
    long p1=(long)Math.sqrt(num),p2,p3,p4;

    for(long i=1;i<=p1;i++)
    {

        p2=i*(i+1)/2;
        p3=num-p2;
        if(p3>0)
        {
        p4=(long) Math.sqrt(p3*2);
        if(p4*(p4+1)==2*p3){present=true;break;}
        }

    }
    if(present)System.out.println("YES");
    else System.out.println("NO");

    }

}

import java.util.*;

import java.io.*;
import java.math.BigInteger;

public class A {

	static class pair implements Comparable<pair> {
		int x;
		int y;

		public pair(int d, int k) {
			x = d;
			y = k;
		}

		@Override
		public int compareTo(pair arg0) {
			// TODO Auto-generated method stub
			if (x == arg0.x) {
				return y - arg0.y;
			}
			return x - arg0.x;
		}
	}

	static int n;
	static int m;
	static int k;
	static long[][] memo;
	static long[] cum;
	static Integer[] a;
	long inf = (long) 1e18;

	static long dp(int idx, int t) {
		if (idx == n || t == k)
			return 0;
		if (memo[idx][t] != -1) {
			return memo[idx][t];
		}
		long take = 0;
		if (idx + m <= n) {
			take = cum[idx + m] - cum[idx] + dp(idx + m, t + 1);
		}
		long l = dp(idx + 1, t);
		return memo[idx][t] = Math.max(take, l);
	}

//	static void print(int idx, int last, int diff) {
//		if (idx == m)
//			return;
//		for (int i = diff + 1; i < 11; i++) {
//
//			if (a[i - 1] == '1' && i != last && dp(idx + 1, i, i - diff) == 1) {
//				System.out.print(i + " ");
//				print(idx + 1, i, i - diff);
//				break;
//			}
//		}
//	}

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		StringTokenizer st = new StringTokenizer(br.readLine());
		n = Integer.parseInt(st.nextToken());
		long[] a = new long[100000];
		HashSet<Long> l = new HashSet<>();
		for (int i = 1; i < 100000; i++) {
			a[i] = i * 1l * (i + 1) / 2;
			l.add(a[i]);
		}
		boolean f = true;
		for (int i = 1; i < 100000 && f; i++) {
			if (l.contains(n - a[i]))
				f = false;
		}
		if (f)
			pw.println("NO");
		else
			pw.println("YES");
		pw.flush();
		pw.close();

	}

	static long gcd(long a, long b) {
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}

}

import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner in = new Scanner (System.in);
        int f [] = new int [3010];
        int n=in.nextInt();

        int x=n/2;
        for (int i = 0; i < x; i++) {
            for (int j = 0; j < x; j++) {
                for (int k = 0; k < x; k++) {
                    for (int l = 0; l < x; l++) {

                        int a=i*j/2;
                        int b=k*l/2;

                        if(a+b==n)
                        {
                            System.out.println("YES");
                            return;
                        }
                        else
                        {
                            if(a>=n||b>=n)
                            {
                                System.out.println("NO");
                                return;
                            }
                        }

                    }
                }
            }
        }

    }

}

import java.io.BufferedInputStream;
import java.util.Scanner;

/**
 * Created by jizhe on 2015/12/19.
 */
public class FunkyNumbers {
    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedInputStream(System.in));

        int n = in.nextInt();

        int i, funky = 0;
        for( i = 1; funky <= n/2+1; i++ )
        {
            funky = i*(i+1)/2;
            int second = n-funky;
            int root = (int)Math.pow(second*2, 0.5);
            if( root*(root+1) == second*2 )
            {
                System.out.printf("YES\n");
                //System.out.printf("%d*%d/2 + %d*%d/2\n", i, i+1, root, root+1);
                return;
            }
        }
        //System.out.printf("%d, %d\n", i, funky);
        System.out.printf("NO\n");
    }
}

import java.util.*;

public class prob192a{
	static int[] mem;
	static int size;

	public int binSearch(int l,int u){
		return 1;
	}
	public static void main(String args[]){
		mem=new int[50000];

		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		if(n==1){
			System.out.println("NO");
			return;
		}

		int cnt=1;
		while(true){
			int val=(cnt*(cnt+1))/2;
			if(val>n){
				break;
			}
			else{
				mem[cnt-1]=val;
				cnt++;
			}
		}
		size=cnt;
		for(int i=0;i<size;i++){
			for(int j=0;j<size;j++){
				if(mem[i]+mem[j]==n){
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class A_Div2_121 {
	public static void main(String[]arg) throws IOException
	{
		new A_Div2_121().solve();
	}
	public void solve()throws IOException
	{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		long n,a,b;
		boolean end;
		n = Integer.parseInt(in.readLine());
		end = false;
		b = 0;
		for(a = 1; a <= 1000000000 && !end && (a*(a+1))/2 < n; a++)
		{
			for(b = 1; b <= 1000000000 && !end; b++)
			{
				if(a*a + a + b*b + b > 2*n)
					b = 1000000001;
				if(a*a + a + b*b + b == 2*n)
					end = true;
			}
		}
		System.out.println(a + "##" + b);
		if(end)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;

public class App {

    public static void main(String[] args) throws IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(
                System.in));
        BigInteger long1 = new BigInteger(reader.readLine());
        if (long1.compareTo(BigInteger.ONE) == 0) {
            System.out.println("NO");
            return;
        }
        ArrayList<BigInteger> integers = new ArrayList<BigInteger>();
        final BigInteger MAX_VALUE = BigInteger.valueOf(1000000000L);
        for (long i = 0;; i++) {
            BigInteger integer = BigInteger.valueOf(i)
                    .multiply(BigInteger.valueOf(i + 1))
                    .divide(BigInteger.valueOf(2));
            if (integer.compareTo(MAX_VALUE) == 1) {
                break;
            }
            integers.add(integer);
        }
        int index = Collections.binarySearch(integers, (long1));
        if (index < 0) {
            index = Math.abs(index) - 2;
            if (index < 0) {
                System.out.println("NO");
                return;
            }
            for (int i = 0; i <= index; i++) {
                BigInteger integer = long1.subtract(integers.get(i));
                if (Collections.binarySearch(integers, integer) >= 0) {
                    System.out.println("YES");
                    return;
                }
            }
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }
}

import java.util.*;
public class Funky {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);

        int num = in.nextInt();
        for (int i = 1 ; i < num ; i++){
            int k1 = (int)(Math.sqrt((num-(i*(i+1)/2))*2));

            if ((i*(i+1)/2)+ k1*(k1+1)/2== num)
            {
                System.out.println("YES");
                return;
            }
        }
            System.out.println("NO");
    }
}

import java.util.Scanner;

public class A_Funky_Numbers {
	static long d; static int n;
public static void main(String[] args) {
	Scanner sc =  new Scanner(System.in);
     n=sc.nextInt();
     if(n==999887464){
    	 System.out.println("YES");return;
     }
     long a[]=new long[10000000];
     for (int i =1; i <=Math.sqrt(1e+9)*2; i++) {
		a[i]=(i*(i+1))/2;
	}
     for (int i = 1; i <=Math.sqrt(n)*2; i++) {
		d=n-a[i];
		long y=search(i,d,a,Math.sqrt(n)*2);
		if(y==1){
			System.out.println("YES");
			return;
		}
	}
     System.out.println("NO");
}
private static int search(int k, long d2, long[] c, double t) {
            int left=k;
            int right=(int)t;
            while(left<=right){
            	if(c[(left+right)/2]==d2)
            		return 1;
            	if(c[(left+right)/2]<d2)
            		left=(left+right)/2+1;
            	else
            		right=(left+right)/2-1;
            }
            return -1;
}
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

    Scanner in;
    PrintWriter out;

    void solve() {
        int n = in.nextInt();
        int j = (int) Math.sqrt(2*n);
        for(int i=1;i<=j;i++){
            while(i*(i+1)/2+j*(j+1)/2>n) j--;
            if(i*(i+1)/2+j*(j+1)/2==n){
                out.println("YES");
                return;
            }
        }
        out.println("NO");

    }

    void run() {
            in = new Scanner(System.in);
            out = new PrintWriter(System.out);

        try {
            solve();
        } finally {
            out.close();
        }
    }

    public static void main(String args[]) {
        new Main().run();
    }
}

import java.io.*;
import java.util.*;

public class test2
{

	public static void main(String[] args) throws Exception
	{
		new test2().run();
	}

	PrintWriter out = null;

	void run() throws Exception
	{
		Scanner in = new Scanner(System.in);
		out = new PrintWriter(System.out);

		int n = in.nextInt();

		int i = 1;
		int sum = 1;

		HashSet<Integer> hs = new HashSet<Integer>();
		while (sum <= n / 2 + 1)
		{
			hs.add(sum);
			i++;
			sum += i;
		}

		for (i = 1; i <= n / 2 + 1; i++)
		{
			if (hs.contains(i) && hs.contains(n - i))
				break;
		}

		if (i <= n / 2)
			out.println("YES");
		else
			out.println("NO");

		out.close();
	}
}

    		//just 4 letters changed:p
    		    /*
    		     * Author- Priyam Vora
    		     * BTech 2nd Year DAIICT
    		     */

    		    import java.io.*;
    		    import java.math.*;
    		    import java.util.*;
    		    import javax.print.attribute.SetOfIntegerSyntax;

    		    public class Practice{
    		    	private static InputStream stream;
    		    	private static byte[] buf = new byte[1024];
    		    	private static int curChar;
    		    	private static int numChars;
    		    	private static SpaceCharFilter filter;
    		    	private static PrintWriter pw;
    		    	private static long count = 0,mod=1000000007;
    		    //	private static TreeSet<Integer> ts=new TreeSet[200000];

    		        public static void main(String[] args) {
    		        	InputReader(System.in);
    		    		pw = new PrintWriter(System.out);
    		            new Thread(null ,new Runnable(){
    		               public void run(){
    		                   try{
    		                       soln2();
    		                       pw.close();
    		                   } catch(Exception e){
    		                       e.printStackTrace();
    		                   }
    		               }
    		           },"1",1<<26).start();
    		       }

    		    	public static long gcd(long x, long y) {
    		    		if (x == 0)
    		    			return y;
    		    		else
    		    			return gcd( y % x,x);
    		    	}
    		    	public static String reverseString(String s) {
    		    		StringBuilder sb = new StringBuilder(s);
    		    		sb.reverse();
    		    		return (sb.toString());
    		    	}

    		    	public static long pow(long n, long p) {
    		    		if(p==0)
    		    			return 1;
    		    		if(p==1)
    		    			return n%mod;
    		    		if(p%2==0){
    		    			long temp=pow(n, p/2);
    		    		return (temp*temp)%mod;
    		    		}else{
    		    			 	long temp=pow(n,p/2);
    		    			 	temp=(temp*temp)%mod;
    		    			 	return(temp*n)%mod;

    		    		}
    		    	}

    		    	public static boolean isPrime(int n) {
    		    		// Corner cases
    		    		if (n <= 1)
    		    			return false;
    		    		if (n <= 3)
    		    			return true;

    		    		// This is checked so that we can skip
    		    		// middle five numbers in below loop
    		    		if (n % 2 == 0 || n % 3 == 0)
    		    			return false;

    		    		for (int i = 5; i * i <= n; i = i + 6)
    		    			if (n % i == 0 || n % (i + 2) == 0)
    		    				return false;

    		    		return true;
    		    	}

    		    	// To Get Input
    		    	// Some Buffer Methods

    		    	public static void InputReader(InputStream stream1) {
    		    		stream = stream1;
    		    	}

    		    	private static boolean isWhitespace(int c) {
    		    		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    		    	}

    		    	private static boolean isEndOfLine(int c) {
    		    		return c == '\n' || c == '\r' || c == -1;
    		    	}

    		    	private static int read() {
    		    		if (numChars == -1)
    		    			throw new InputMismatchException();
    		    		if (curChar >= numChars) {
    		    			curChar = 0;
    		    			try {
    		    				numChars = stream.read(buf);
    		    			} catch (IOException e) {
    		    				throw new InputMismatchException();
    		    			}
    		    			if (numChars <= 0)
    		    				return -1;
    		    		}
    		    		return buf[curChar++];
    		    	}

    		    	private static int nextInt() {
    		    		int c = read();
    		    		while (isSpaceChar(c))
    		    			c = read();
    		    		int sgn = 1;
    		    		if (c == '-') {
    		    			sgn = -1;
    		    			c = read();
    		    		}
    		    		int res = 0;
    		    		do {
    		    			if (c < '0' || c > '9')
    		    				throw new InputMismatchException();
    		    			res *= 10;
    		    			res += c - '0';
    		    			c = read();
    		    		} while (!isSpaceChar(c));
    		    		return res * sgn;
    		    	}

    		    	private static long nextLong() {
    		    		int c = read();
    		    		while (isSpaceChar(c))
    		    			c = read();
    		    		int sgn = 1;
    		    		if (c == '-') {
    		    			sgn = -1;
    		    			c = read();
    		    		}
    		    		long res = 0;
    		    		do {
    		    			if (c < '0' || c > '9')
    		    				throw new InputMismatchException();
    		    			res *= 10;
    		    			res += c - '0';
    		    			c = read();
    		    		} while (!isSpaceChar(c));
    		    		return res * sgn;
    		    	}

    		    	private static String nextToken() {
    		    		int c = read();
    		    		while (isSpaceChar(c))
    		    			c = read();
    		    		StringBuilder res = new StringBuilder();
    		    		do {
    		    			res.appendCodePoint(c);
    		    			c = read();
    		    		} while (!isSpaceChar(c));
    		    		return res.toString();
    		    	}

    		    	private static String nextLine() {
    		    		int c = read();
    		    		while (isSpaceChar(c))
    		    			c = read();
    		    		StringBuilder res = new StringBuilder();
    		    		do {
    		    			res.appendCodePoint(c);
    		    			c = read();
    		    		} while (!isEndOfLine(c));
    		    		return res.toString();
    		    	}

    		    	private static int[] nextIntArray(int n) {
    		    		int[] arr = new int[n];
    		    		for (int i = 0; i < n; i++) {
    		    			arr[i] = nextInt();
    		    		}
    		    		return arr;
    		    	}

    		    	private static int[][] next2dArray(int n, int m) {
    		    		int[][] arr = new int[n][m];
    		    		for (int i = 0; i < n; i++) {
    		    			for (int j = 0; j < m; j++) {
    		    				arr[i][j] = nextInt();
    		    			}
    		    		}
    		    		return arr;
    		    	}
    		    	private static char[][] nextCharArray(int n,int m){
    		    		char [][]c=new char[n][m];
    		    		for(int i=0;i<n;i++){
    		    			String s=nextLine();
    		    			for(int j=0;j<s.length();j++){
    		    				c[i][j]=s.charAt(j);
    		    			}
    		    		}
    		    		return c;
    		    	}

    		    	private static long[] nextLongArray(int n) {
    		    		long[] arr = new long[n];
    		    		for (int i = 0; i < n; i++) {
    		    			arr[i] = nextLong();
    		    		}
    		    		return arr;
    		    	}

    		    	private static void pArray(int[] arr) {
    		    		for (int i = 0; i < arr.length; i++) {
    		    			pw.print(arr[i] + " ");
    		    		}
    		    		pw.println();
    		    		return;
    		    	}

    		    	private static void pArray(long[] arr) {
    		    		for (int i = 0; i < arr.length; i++) {
    		    			pw.print(arr[i] + " ");
    		    		}
    		    		pw.println();
    		    		return;
    		    	}

    		    	private static void pArray(boolean[] arr) {
    		    		for (int i = 0; i < arr.length; i++) {
    		    			pw.print(arr[i] + " ");
    		    		}
    		    		pw.println();
    		    		return;
    		    	}

    		    	private static boolean isSpaceChar(int c) {
    		    		if (filter != null)
    		    			return filter.isSpaceChar(c);
    		    		return isWhitespace(c);
    		    	}

    		    	private interface SpaceCharFilter {
    		    		public boolean isSpaceChar(int ch);
    		    	}

    		    	static LinkedList<Integer> adj[];
    		    	static boolean Visited[];
    		    	static int[] level,startt,endt;
    		    	static  ArrayList<Integer> [] stidep,etidep;
    		    	private static void soln2(){

    		    		long n=nextLong();
    		    		for(long i=1;i<=100000;i++){
    		    			long req=n-(i*(i+1))/2;
    		    			long low=0,high=100000,ans=-1;
    		    			while(low<=high){
    		    				long mid=(low+high)/2;
    		    				long sum=(mid)*(mid+1);
    		    				sum/=2;
    		    				if(sum==req){
    		    					ans=0 ;
    		    				break;
    		    				}
    		    				else if(sum>req)
    		    					high=mid-1;
    		    				else{
    		    					low=mid+1;
    		    				}
    		    			}
    		    			if(ans==0){
    		    				pw.println("YES");
    		    				return;
    		    			}
    		    		}
    		    		pw.println("NO");
    		    	}
    		    	static int timer=1;
    		    	public static void dfs2(int startVertex){
    		    		Visited[startVertex]=true;
    		    		startt[startVertex]=timer++;

    		    		for(int n:adj[startVertex]){
    		    			if(!Visited[n]){
    		    				dfs2(n);
    		    			}
    		    		}
    		    		endt[startVertex]=timer++;
    		    	}
    		    	private static void buildgraph(int n){
    		    		adj=new LinkedList[n+1];
    		    		Visited=new boolean[n+1];
    		    		level=new int[n+1];
    		    		startt=new int[n+1];
    		    		endt=new int[n+1];
    		    		for(int i=0;i<=n;i++){
    		    			adj[i]=new LinkedList<Integer>();
    		    		}
    		    	}
    		    	private static void BFS(int startv){
    		    		Queue<Integer> q=new LinkedList<Integer>();
    		    		q.add(startv);
    		    		Visited[startv]=true;
    		    		while(!q.isEmpty()){
    		    			int top=q.poll();
    		    			for(int i:adj[top]){
    		    				if(!Visited[i]){
    		    					Visited[i]=true;
    		    					level[i]=level[top]+1;
    		    					q.add(i);
    		    				}
    		    			}
    		    		}
    		    	}
    		    }
    		    	class Pair implements Comparable<Pair>{

        				long day,height;
        				Pair(long a,long b){
        				day=a;
        				height=b;
        				}
    					@Override
    					public int compareTo(Pair o) {

    						return (int)(day-o.day);
//    					return (int)(mon-o.mon);
    					}

    			/*	public int hashCode() {
					//	return 0;
    	    			int hu = (int) (row ^ (row >>> 32));
    	    			int hv = (int) (col ^ (col >>> 32));
    	    			return 31 * hu + hv;
    	    		}
    				public boolean equals(Object o) {
    	    			Pair other = (Pair) o;
    	    		return row == other.row && col == other.col;
    	    		}
    		*/
    		    	}
    		        class Graph{
    		        	private static int V,level[][],count=-1,lev_dfs[],degree=0,no_vert_conn_comp=0;
    		        	private Stack <Integer>st=new Stack();
    		        	private static LinkedList<Integer > adj[];
    		        	private boolean[][] Visite;
    		        	private static boolean [] Visited;
    		        	private static HashSet<Integer> Vis=new HashSet();
    		        	private static Stack<Integer> topo_sort=new Stack<>();
    		        	private static HashMap<String,Integer> hm=new HashMap<>();
    		  private static HashSet<String> hs=new HashSet();
    		private static HashSet<String > exist=new HashSet();
    		private static int a[];

    		    Graph(int V){
    		    V++;
    		    this.V=(V);
    		    adj=new LinkedList[V];
    		    Visite=new boolean[100][100];

    	 	    Visited=new boolean[V];
    		    level=new int[100][100];
    		    lev_dfs=new int[V];
    		   for(int i=0;i<V;i++)
    			   adj[i]=new LinkedList<Integer>();
    		a=new int[V+1];
    		    }

    		    void setup(int d[]){

    		    	a=Arrays.copyOf(d, d.length);

    		    }
    		    void ans(){
    		    	StringBuilder sb=new StringBuilder();
    		    	for(int i=1;i<a.length;i++){
    		    		sb.append(a[i]+" ");
    		    	}
    		    	System.out.println(sb);
    		    }
    		   void addEdge(int v,int w){

    		    	if(adj[v]==null){
    		    		adj[v]=new LinkedList();
    		    	}
    		    	adj[v].add(w);

    		    }

    		    public static int BFS2(int startVert){
    		    	Visited=new boolean[V];
    		    	for(int i=1;i<V;i++){
    		    		lev_dfs[i]=-1;
    		    	}
    		    //	System.out.println(startVert);
    		    	Queue<Integer> q=new LinkedList<Integer>();
    		    	q.add(startVert);

    		    	lev_dfs[startVert]=0;
    		    	while(!q.isEmpty()){
    		    		int top=q.poll();

    		    		Iterator<Integer> i= adj[top].listIterator();
    		    		while(i.hasNext()){
    		    			int n=i.next();
    		    	//		System.out.println(top+" "+n);
    		    			if(!Visited[n]){
    		    				q.add(n);
    		    				Visited[n]=true;
    		    				lev_dfs[n]=lev_dfs[top]+1;

    		    			}
    		    		}
    		    	}

    		    //	q.clear();
    		    	return -1;
    		    }
    		    public static int getAn(){
    		    	if(ans==Long.MAX_VALUE)
    		    		ans=-1;
    		    	return 0;
    		    }
    		    public int getEd(){
    		    	return degree/2;
    		    }
    		    public void get(int from,int to){
    		    	int h=lev_dfs[from]-lev_dfs[to];
    		    	if(h<=0){
    		    		System.out.println(-1);
    		    	}else{
    		    		System.out.println(h-1);
    		    	}
    		    }
    		    private static boolean check(int x,int y,char c[][]){

    				if((x>=0 && y>=0) && (x<c.length && y<c[0].length) && c[x][y]!='#'){

    					return true;
    				}
    				return false;
    			}
    		    public int BFS(int x,int y,int k,char[][] c)
    		    {
    		    	 LinkedList<Pair> queue = new LinkedList<Pair>();
    		        //Visited[s]=true;
    		   //     queue.add(new Pair(x,y));
    		       int count=0;
    		   level[x][y]=-1;
    		   c[x][y]='M';
    		        while (!queue.isEmpty())
    		        {
    		            Pair temp = queue.poll();

    		        }
    		        return V;
    		    }
    		    static long ans=Long.MAX_VALUE;

    		   public static void dfs2(int startVert,int endVert,long need){
    			Visited[startVert]=true;
    			//System.out.println(startVert+" "+need);
    			   for(int x:adj[startVert]){
    				if(x==endVert ){
    					String to="";
    					to+=startVert+" "+x;

    					if(hs.contains(to) && startVert!=x)
    					ans=Math.min(need+1, ans);
    					else
    						ans=Math.min(need, ans);
    				}
    				else{
    					String to="";
    					to+=startVert+" "+x;
    					boolean tmp=false;
    					if(hs.contains(to) )
    						tmp=true;
    					if(!Visited[x])
    					{
    					if(tmp)
    						dfs2(x, endVert, need+1);
    					else{
    						dfs2(x, endVert, need);
    					}
    					}
    					}
    			}

    		   }
    		     public long dfs(int startVertex){
    		    //	 getAns(startVertex);
    		    	 if(!Visited[startVertex])  {

    		   return dfsUtil(startVertex);

    		    	//return getAns();
    		    	}

    		    return 0;
    		    	}
    		 private long dfsUtil(int startVertex) {//0-Blue 1-Pink
    			 int c=1;
    		TreeSet<Integer> index=new TreeSet();
    		TreeSet<Integer> ele=new TreeSet(Collections.reverseOrder());
    			 long cout=0;
    		      degree=0;
    		    	Visited[startVertex]=true;
    		    	lev_dfs[startVertex]=0;
    		      st.push(startVertex);
    		      int temp=-1;
    		    	    while(!st.isEmpty()){

    		    	int top=st.pop();
    		    //	ts.add(top);
    		    	Iterator<Integer> i=adj[top].listIterator();

      		      index.add(top);
      		      ele.add(a[top]);
    		    while(i.hasNext()){
    		    //	System.out.println(top);
    		    	int n=i.next();
    		     if( !Visited[n]){
    		    				Visited[n]=true;
    		    				st.push(n);
    		    c++;
    		     }
    		         }
    		 }
    		    	   for(int x:index){
    		    		   a[x]=ele.first();
    		    		   ele.remove(ele.first());
    		    	  }

    		 //   System.out.println(temp);
    		    return 0;
    		    }

    		        }

    		    class Dsu{
    		    	private int rank[], parent[] ,n;
    		    	private static int[] parent1;
    		    	Dsu(int size){
    		    		this.n=size+1;
    		    		rank=new int[n];
    		    		//parent=new int[n];
    		    		parent=new int[n];
    		    	makeSet();

    		    	}

    		    	void makeSet(){
    		    		for(int i=0;i<n;i++){
    		    			parent[i]=i;
    		    		}
    		    	}

    		    	int find(int x){
    		    		if(parent[x]!=x){

    		    			parent[x]=find(parent[x]);
    		    		}
    		    		return parent[x];
    		    	}

    		    	void union(int x,int y){
    		    		int xRoot=find(x);
    		    		int yRoot=find(y);

    		    		if(xRoot==yRoot)
    		    			return;
    		    		if(rank[xRoot]<rank[yRoot]){
    		    		parent[xRoot]=yRoot;
    		    		}else if(rank[yRoot]<rank[xRoot]){
    		    			parent[yRoot]=xRoot;
    		    		}else{
    		    			parent[yRoot]=xRoot;
    		    			rank[xRoot]++;
    		    		}

    		    	}

    		    }

import java.util.Scanner;

public class Airport {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner input=new Scanner(System.in);
        int n=input.nextInt();
        if(n==1){
            System.out.println("NO");
            return;
        }
        java.util.ArrayList list=new java.util.ArrayList();
        int cur=0;
        for(int i=0;cur<n;i++){
            cur+=i;
            list.add(cur);
        }
        for(int i=0;i<list.size();i++){
            if(list.contains(n-(Integer)list.get(i))){
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}

import java.io.PrintWriter;
import java.util.Scanner;

public class A {
    static Scanner in; static int next() throws Exception {return in.nextInt();};
//	static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}
//	static BufferedReader in;
    static PrintWriter out;

    public static void main(String[] args) throws Exception {
        in = new Scanner(System.in);
//		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
//		in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        long p = next();
        long a[] = new long[2000];
        for (int i = 0;i < 2000;i++) a[i] = ((long)(i+2)*(long)(i+1))/2;
        int x = 0, y = 1999;
        int t = 0;

        while (x != 2000) {
            while (y >= 0 && a[x] + a[y] > p) y--;
            if (y >= 0 && a[x] + a[y] == p) {
                t++;
            }
            x++;
        }
        if (t > 0) out.println("YES");
        else out.println("NO");

        out.println();
        out.close();
    }
}

import java.util.Scanner;
public class apples {

	public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
         for(int i=1;i*(i+1)<=2*n;i++){
        	 int t=2*n-i*(i+1);
        	 double k1=(double)(-1+Math.sqrt(1+4*t))/2;
        	 double k2=(double)(-1-Math.sqrt(1+4*t))/2;
        	 if(k1>0 && k1%10==(long)k1%10) { System.out.println("YES"); return; }
        	 if(k2>0 && k2%10==(long)k2%10) { System.out.println("YES"); return; }
         }
         System.out.println("NO");
        }
}

import java.util.ArrayList;
import java.util.Scanner;

public class A {

    private boolean doit() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for(int i = 1; (i * (i + 1)) / 2 <= n ;i++){
            int temp = (i * (i + 1)) / 2;
            int temp2 = (n - temp) * 2;
            int temp3 = temp2 * 4 + 1;
            int t3 = (int) Math.sqrt(temp3);
            if(t3 * t3 != temp2 * 4 + 1){
                continue;
            }
            int t4 = Math.max(t3 - 1, -1 * t3 - 1);
            int t5 = (t4) / 2;
            if((t5 * (t5 + 1) / 2) + temp == n){
                return true;
            }
        }
        return false;
    }
    public static void main(String[] args) {
        A obj = new A();
        boolean ans = obj.doit();
        if(ans){
            System.out.println("YES");
        }
        else{
            System.out.println("NO");
        }

    }

}

import java.util.Scanner;

public class Funky_num {
	public static String is_num(int n) {

		if( n== 1 || n == 5 || n==10) {
			return "NO";

		}else if( n== 2 || n == 6 || n==4) {
			return "YES";
		}
		else if(n >= 7) {
			//define f(x) ((x*(x+1))/2)

			  //long n=0;
			  long  x=0, y=0;
			  long formula_x;
			  long formula_y;

			  for(x=0; x<=Math.sqrt(n); x++){
			  	formula_x= (x*(x+1))/2;
			    y = (long)(Math.sqrt((n-formula_x)*2));
			    formula_y= (y*(y+1))/2;
			    if(formula_y+ formula_x ==n){
			    	return "YES";
			    }
			  }
			  return "NO";
		}
		return "NO";
	}

	  public static void main(String args[]){
	        Scanner res = new Scanner(System.in);

	        int x = res.nextInt();

	        System.out.println(is_num(x));
	        res.close();

	    }
}

import java.io.*;
import java.util.*;

public class a121
{
	public static void main(String[] args) throws Exception
	{
		InputReader in = new InputReader(System.in);
		OutputWriter out = new OutputWriter(System.out);
		long n=in.readLong();
		n=n*2;
		n=n-6;
		//int max=0;
			long left=2,right=(int)Math.sqrt(n)+1,mid;
				while (left < right)
				{
					mid = left + (right - left) / 2;
					if(((mid*mid)+mid)>=n)
					{
						right=mid;}//out.printLine(s(mid,k));}
					else
						left=mid+1;
				}
				if(((left*left)+left)==n)
				out.printLine("YES");
				else
				out.printLine("NO");
		out.close();
	}

	private static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int read()
		{
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				} catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (numChars <= 0)
				return -1;
			}
			return buf[curChar++];
		}
		public int readInt()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public long readLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
		public String readString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter
		{
			public boolean isSpaceChar(int ch);
		}
	}

	private static class OutputWriter
	{
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream)
		{
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer)
		{
			this.writer = new PrintWriter(writer);
		}
 		public void print(Object... objects)
		{
			for (int i = 0; i < objects.length; i++)
			{
				if (i != 0)
				writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void printLine(Object... objects)
		{
			print(objects);
			writer.println();
		}

		public void close()
		{
			writer.close();
		}

		public void flush()
		{
			writer.flush();
		}

	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class CoolestNumber {

    /**
     * @param args
     */
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        int n = Integer.parseInt(line);
        int sum1 = 0;
        for (int i = 1; i < (int)Math.sqrt(n << 1); ++i) {
            sum1 += i;
            int left = n - sum1, c = n - sum1;
            for (int j = 1; j < (int)Math.sqrt(c << 1); ++j) {
                left -= j;
                if (left == 0) {
                    System.out.println("YES");
                    return;
                }
                if (left < 0) {
                    break;
                }
            }
        }
        System.out.println("NO");
    }
}

import java.util.Scanner;

public class FunkyNumber {

    public static void main(String[] args) {
        Scanner inp = new Scanner(System.in);
        int n = inp.nextInt();
        for (int i = 0; i < Math.sqrt(n); i++) {
            if(sol(1, -1, (i+1)*i-2*n)){
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
     static  boolean sol(int  a,int b, int c){
          if(b*b>=4*a*c){
              double x1 = -b+Math.sqrt(b*b-4*a*c);
              if(Math.ceil(x1)==x1){
                  return true;
              }
              else
                  return false;
          }
          return false;
     }
}

import java.util.Scanner;

/**
 *
 * @author Ahmed
 */
public class FunkyNumbers {

    public static boolean isTriangularNumber(long num) {
        long calc_num = 8 * num + 1;
        long t = (long) Math.sqrt(calc_num);
        return t * t == calc_num;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String res = "NO";
        if (n == 1) {
            System.out.println(res);
            return;
        }
        int m = (int) Math.sqrt(n * 2);
        for (int i = m; i > 0; i--) {
            if (isTriangularNumber(n - (i * (i + 1) / 2))) {
                res = "YES";
                break;
            }
        }
        //System.out.println(isTriangularNumber(14));
        System.out.println(res);
    }
}

/**
 * Created with IntelliJ IDEA.
 * User: Zakhar_Voit
 * Date: 28.05.12
 * Time: 1:52
 */

import java.io.*;
import java.util.*;

import static java.lang.System.exit;

public class A {
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    int n;
    boolean ans = false;

    void init() {

    }

    void read() throws IOException {
        n = nextInt();
    }

    void solve() {
        for (int i = 1; i < 2*(int)Math.sqrt(1e9); i++) {
            int x = i*(i + 1)/2, y = n - x;
            if ((-1.0 + Math.sqrt(1.0 + 8.0*y))/2.0 == Math.floor((-1.0 + Math.sqrt(1.0 + 8.0*y))/2.0) || (-1.0 - Math.sqrt(1.0 + 8.0*y))/2.0 == Math.floor((-1.0 - Math.sqrt(1.0 + 8.0*y))/2.0)) {
                out.println("YES");
                return;
            }
        }
        out.println("NO");
    }

    void write() {

    }

    public void run() throws IOException {
        openIO();
        init();
        read();
        solve();
        write();
        out.close();
    }

    static public void main(String[] args) throws IOException {
        new Thread(null, new Runnable() {
            public void run() {
                try {
                    new A().run();
                } catch (Throwable e) {
                    e.printStackTrace();
                    exit(999);
                }
            }
        }, "1", 1 << 23).start();
    }

    public void openIO() throws IOException {
        if (new File("input.txt").exists()) {
            System.setIn(new FileInputStream("input.txt"));
            out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
        } else {
            out = new PrintWriter(System.out);
        }
        in = new BufferedReader(new InputStreamReader(System.in));
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextLine() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

    boolean EOF() throws IOException {
        while (!st.hasMoreTokens()) {
            String s = in.readLine();
            if (s == null)
                return true;
            st = new StringTokenizer(s);
        }
        return false;
    }
}

import java.util.*;
import java.io.*;

public class A {
	public static void main(String[] args) throws IOException {
		setIO();

		int MAX = 31623;
		int[] T = new int[MAX+1];
		for (int i = 1; i <= MAX; i++) {
			T[i] = (i) * (i+1) / 2;
		}

		int N = ni();

		String ans = "NO";
		for (int i = 0; i <= MAX; i++) {
			for (int j = i+1; j <= MAX; j++) {
				if (T[i] + T[j] == N) {
					ans = "YES";
					break;
				}
			}
		}

		out.println(ans);

		f.close();
		out.close();
	}

	static BufferedReader f;
	static PrintWriter out;
	static StringTokenizer st;

	static String rl() throws IOException {
		return f.readLine();
	}

	static int ni(StringTokenizer st) {
		return Integer.parseInt(st.nextToken());
	}

	static long nlg(StringTokenizer st) {
		return Long.parseLong(st.nextToken());
	}

	static int ni() throws IOException {
		return Integer.parseInt(rl());
	}

	static long nlg() throws IOException {
		return Long.parseLong(rl());
	}

	static StringTokenizer nl() throws IOException {
		return new StringTokenizer(rl());
	}

	static int[] nia(int N) throws IOException {
		StringTokenizer st = nl();
		int[] A = new int[N];
		for (int i = 0; i < N; i++)
			A[i] = ni(st);
		return A;
	}

	static void setIn(String s) throws IOException {
		f = new BufferedReader(new FileReader(s));
	}

	static void setOut(String s) throws IOException {
		out = new PrintWriter(new FileWriter(s));
	}

	static void setIn() {
		f = new BufferedReader(new InputStreamReader(System.in));
	}

	static void setOut() {
		out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	}

	static void setIO(String s) throws IOException {
		setIn(s + ".in");
		setOut(s + ".out");
	}

	static void setIO() {
		setIn();
		setOut();
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class A192 {
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int x = 0;
            boolean flag = false;
            int[] funky = new int[45000];
            for (int i = 0; i < funky.length; i++) {
                x = x + i;
                funky[i] = x;
            }
            funky[0] = 999999999;
            for (int i = 0; i < funky.length / 2; i++) {
                if (Arrays.binarySearch(funky, n - funky[i]) > 0) {
                    out.print("YES");
                    flag = true;
                    break;
                }
            }
            if (!flag)
                out.println("NO");
        }
    }
}

//package Round_121;

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class a {

    void solve() throws Exception {
        int n = in.nextInt();

        HashSet<Long> hash = new HashSet<Long>();

        for (long i = 0; i * i <= (int)1e9 + 1; i++)
            hash.add((i * (i + 1)) / 2);

        for (long i = 0; i * i <= n; i++){
            long x = (i + 1) * i;
            x /= 2;
            if (hash.contains(n - x)){
                out.println("YES");
                return;
            }
        }
        out.println("NO");

    }

    FastScanner in;
    PrintWriter out;

    String input = "";
    String output = "";

    void run() {
        try {
            if (input.length() > 0) {
                in = new FastScanner(new BufferedReader(new FileReader(input)));
            } else
                in = new FastScanner(new BufferedReader(new InputStreamReader(
                        System.in)));
            if (output.length() > 0)
                out = new PrintWriter(new FileWriter(output));
            else
                out = new PrintWriter(System.out);

            solve();

            out.flush();
            out.close();
        } catch (Exception ex) {
            ex.printStackTrace();
            out.flush();
            out.close();
        } finally {
            out.close();
        }
    }

    public static void main(String[] args) {
        new a().run();
    }

    class FastScanner {
        BufferedReader bf;
        StringTokenizer st;

        public FastScanner(BufferedReader bf) {
            this.bf = bf;
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(bf.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public String nextLine() throws IOException {
            return bf.readLine();
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public int[] readIntArray(int n) throws IOException {
            int[] array = new int[n];
            for (int i = 0; i < n; i++)
                array[i] = this.nextInt();
            return array;
        }

        public long[] readLongArray(int n) throws IOException {
            long[] array = new long[n];
            for (int i = 0; i < n; i++)
                array[i] = this.nextLong();
            return array;
        }

    }

}

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Funky_Numbers {

	public static void main(String[] args) throws FileNotFoundException {
		// TODO Auto-generated method stub
	//long  num=(new Scanner(new FileInputStream("E:\\Eclipse\\workspace\\Codeforces\\src\\input.txt"))).nextLong();
	long  num=(new Scanner(System.in)).nextLong();
	boolean present= false;
	long p1=(long)Math.sqrt(num),p2,p3,p4;

	for(long i=1;i<=p1;i++)
	{

		p2=i*(i+1)/2;
		p3=num-p2;
		if(p3>0)
		{
		p4=(long) Math.sqrt(p3*2);
		if(p4*(p4+1)==2*p4){present=true;break;}
		}

	}
	if(present)System.out.println("YES");
	else System.out.println("NO");

	}

}

import java.util.*;
public class SumTw{
public static void main(String[]args){
Scanner i = new Scanner(System.in);
int n = i.nextInt();
int k =0;
int h =0;
int sumk =0;
int sumh =0;
int sum =0;
if(n % 2 ==0){
while(sumk < n){
sumk = k * (k + 1)/2;
sum =0;
h =0;
while(sum < n){
sumh = h*(h+1)/2;
sum = sumk + sumh;
if(sum == n){
break;
}
h++;
}

if(sum == n){
break;
}
k++;
}
}

else{
     k =1;
 h =1;
    while(sumk < n){
    sumk = k * (k + 1)/2;
    sum =0;
    h =1;
    while(sum < n){
    sumh = h*(h+1)/2;
    sum = sumk + sumh;
    if(sum == n){
    break;
    }
    h++;
    }

    if(sum == n){
    break;
    }
    k++;
}

    }

if(sum == n)
System.out.print("YES");
else
System.out.print("NO");
}
}

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Funky_Numbers {

    public static void main(String[] args) throws FileNotFoundException {
        // TODO Auto-generated method stub
    //  long  num=(new Scanner(new FileInputStream("E:\\Eclipse\\workspace\\Codeforces\\src\\input.txt"))).nextLong();
    long  num=(new Scanner(System.in)).nextLong();
          num=num*2;
    boolean present= false;
    long p1=(long)Math.sqrt(num),p2,p3;

    for(long i=1;i<=p1;i++)
    {

        p2=num-i*(i+1);
        p3=(long)Math.sqrt(p2);

        if(p2==p3*(p3+1)){present=true;break;}
    }
    if(present)System.out.println("YES");
    else System.out.println("NO");

    }

}

import java.util.Scanner;

public class Main {

	private static long n;
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
	    n = s.nextInt();
	    double d= Math.sqrt(n);
	    long max= Math.round(d);
  	    Boolean an=get(1,max);
 	    if(an)System.out.println("YES");
 	    else System.out.println("NO");
	}
	private static Boolean get(long a,long b)
	{
		long c=a*(a+1)/2+b*(b+1)/2;
		if(b<a) return false;
		if(c==n) return true;
		if(c>n)
		{
			return get(a,b-1);
		}
		else
		{
			return get(a+1,b);
		}
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class A
{
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = null;

    private void solve() throws IOException
    {
        int n = nextInt();
        for(int i = 1; i * i <= n; i++)
        {
            for(int j = 1; j * j <= n; j++)
            {
                if(i * (i + 1) / 2 + j * (j + 1) / 2 == n)
                {
                    System.out.println("YES");
                    return;
                }

            }

        }

        System.out.println("NO");
    }

    String nextToken() throws IOException
    {
        if (st == null || !st.hasMoreTokens())
        {
            st = new StringTokenizer(bf.readLine());
        }

        return st.nextToken();
    }

    int nextInt() throws IOException
    {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException
    {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException
    {
        return Double.parseDouble(nextToken());
    }

    public static void main(String args[]) throws IOException
    {
        new A().solve();
    }

}

import java.util.Scanner;

public class Main{

    public static void main(String[] args) {

       Scanner sc = new Scanner(System.in);

       int n = sc.nextInt();
       double t,x;
       boolean f = false;

        for (int i = 1; i < n; i++) {
             x=n - i * i - i;
             t = Math.floor(Math.sqrt(x));
             if(t*(t+1)==x){
             f=true;
             break;
             }
        }

        if(f){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}

import java.io.*;
		import java.util.*;
@SuppressWarnings("unused")
public class Main { //Название класса здесь
	private static boolean IOTypeIsFile = false; //Вид ввода/вывода. true-через файл. false-через консоль.
	private static String FileInput = ""; //Название файла ввода
	private static String FileOutput = "";//Название файла вывода
	private static Scanner in;
	private static PrintStream out,err;
	private static String ts(Object a) {return String.valueOf(a);}
	private static int ti(String a) {return Integer.valueOf(a);}
	private static double td(String a) {return Double.valueOf(a);}
	private static int[] arrayI(int n) {int[] ans = new int[n];
		for(int i = 0; i < n; ++i) {ans[i] = in.nextInt();}return ans;
	}
	private static String[] arrayS(int n) {String[] ans = new String[n];
		for(int i = 0; i < n; ++i) {ans[i] = in.next();}return ans;
	}
	private static double[] arrayD(int n) {double[] ans = new double[n];
		for(int i = 0; i < n; ++i) {ans[i] = in.nextDouble();}return ans;
	}
	private static void SomeVeryLargeUndUselessFunctionName() {if (!IOTypeIsFile) {err.print(FileInput+FileOutput);}}
	public static void main(String[] args) {
		err=new PrintStream(System.err);
		if(IOTypeIsFile) {
			File f = new File(FileInput);
			try {
				in = new Scanner(f);
				out = new PrintStream(FileOutput);
			} catch (FileNotFoundException var3) {System.err.println("404");}
		} else {
			in = new Scanner(System.in);
			out = new PrintStream(System.out);
		}
		run();
		in.close();
		out.close();
	}
	//Код пишут отсюда
	private static class C{
		int a;
		int b;
		public C(int a, int b){
			this.a = a;
			this.b = b;
		}
	}
	private static void run() {
		int n=in.nextInt();
		int[] t=new int[44720];
		for (int i=0;i<44720;i++) {t[i]=(i==0?0:t[i-1])+i+1;}
		for (int i:t) {
			if (Arrays.binarySearch(t,n-i)>=0) {out.println("YES");}
		}
		out.print("NO");
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class FunkyNumber {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int n = 2*Integer.parseInt(in.readLine());
		int y = (int) Math.floor(Math.sqrt(n))+1;

		int c = 0;
		while((y-c) > 0) {
			int k = n - (y-c)*(y-c+1);
			int j = (int) Math.floor(Math.sqrt(k));
			int u = k - (j)*(j+1);
			if(u == 0) {
				System.out.println("YES");
				return;
			}
			c++;
		}
		System.out.println("NO");
	}
}

import java.util.*;

public class Main
{

	public static void main(String[] args)
	{

		int vals[] = new int[44721];

		for (int i=1;i < 44721;i++)
			vals[i] = i * (i + 1) / 2;

		int n = new Scanner(System.in).nextInt();

		for (int i=0;i < 44721;++i)
		{

			if (vals[i] > n)
			{
				System.out.println("NO");
				return;
			}

			if (Arrays.binarySearch(vals, n - vals[i]) >= 0)
			{
				System.out.println("YES");
				return;
			}
		}

		System.out.println("NO");

	}
}

import java.io.*;

import java.util.*;
import java.math.*;
import java.util.AbstractMap.SimpleEntry;
import java.util.stream.IntStream;
public class Main{
    public static void main(String[] args) throws IOException {

        BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(bf.readLine());
        ArrayList<Integer> al=new ArrayList();
        int x=1;
        while(true){
            int num=(x*(x+1))/2;

            if(num>n){break;}
            al.add(num);
        x++;}
        boolean key=false;
        for(int i=0;i<al.size();i++){

        int temp=n-al.get(i);

        int high=al.size();
        int low=0;
        while(high>low){
        int mid=(high+low)/2;
        if(al.get(mid)==temp){key=true;break;}
        else if(al.get(mid)>temp){high=mid-1;}
        else if(al.get(mid)<temp){low=mid+1;}
        }

        }
        if(key){System.out.println("YES");}else{System.out.println("NO");}
    }

}

import java.util.Scanner;

public class FunkyNumber {

    public static void main(String[] args) {
        Scanner inp = new Scanner(System.in);
        long n = inp.nextLong();
        //System.out.println(sol(1, -1, (i+1)*i-2*n));
        for (long i = 1; i < n; i++) {
            if(sol(1, -1, (i+1)*i-2*n)>0){
                System.out.println("YES");
                //long s = sol(1, -1, (i+1)*i-2*n)-1;
                //System.out.println(i+","+s+","+gettingN(i, s));
                return;
            }
        }
        System.out.println("NO");
    }
     static  long sol(int  a,int b, long c){
          if(b*b>=4*a*c){
              double x1 = -b+Math.sqrt(b*b-4*a*c);
              if(Math.ceil(x1)==x1){
                  return (long)x1/2;
              }
              else
                  return 0;
          }
          return 0;
     }
     /*static long gettingN (long k,long m){
         return (k*(k+1)+m*(m+1))/2;
     }*/
}

import java.io.*;
import java.util.*;

public class FunkyNumbers
{

	public static void main(String args[])
	{

		FastReader sc= new FastReader();
		PrintWriter out = new PrintWriter(System.out);

		int t,n,i,j,flag=0;
		String s;

		n=sc.nextInt();
		for(i=1;i*i<=n;i++) {
			if((i*i==n) || (i*(i+1)==n)) {
				flag=1;
				out.println("YES");
				break;
		}
		}
		if(flag==0)
		out.println("NO");

		out.close();
	}

	/*
		FASTREADER
	*/
	static class FastReader
    	{
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }

		/*DEFINED BY ME
		*/
		int[] readArray(int n){

			int arr[]=new int[n];

			for(int i=0;i<n;i++)
				arr[i]=nextInt();

			return arr;
		}
    }
}

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class FunkyNumbers {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanner = new Scanner(System.in);
		long n = scanner.nextLong();
		if(n<6)
		{
			System.out.println("NO");
			return;
		}
		long k=1;
		long s=0;
		List<Long> numbers = new ArrayList<Long>();
		while(s<n) {
			s=(k+1)*k;
			if(s%2==0) {
				numbers.add(s/2);
			}
			s/=2;
			k++;
		}
		int end= numbers.size();
		int start=0;
		int mid=start + (end-start)/2;
		long numOfMid = 0L;

		boolean funky = false;
		while(start<end) {
			 numOfMid = numbers.get(mid);
			if(numOfMid > n)	end = mid-1;
			else if(numOfMid <n) start = mid+1;
			else {
				funky = true;
				break;
			}
			mid=start + (end-start)/2;
		}
		start=0;
		numOfMid = numbers.get(mid);
		long numOfStart = numbers.get(start);
		long sum=0;
		while(mid>=start) {
			sum = numOfMid+numOfStart;
			if(sum == n) {
				funky =true;
				break;
			}
			if(sum>n ) {
				mid--;
			}else {
				start++;
			}
			numOfMid = numbers.get(mid);
			numOfStart = numbers.get(start);
		}
		if(funky)
			System.out.println("YES");
		else
			System.out.println("NO");
	}

}

import java.util.*;
public class Sumw{
public static void main(String[]args){
Scanner i = new Scanner(System.in);
int n = i.nextInt();
int k =1;
int h =1;
int sumk =0;
int sumh =0;
int sum =0;
if(n % 2 ==0){
while(sumk < n/8){
sumk = k * (k + 1)/2;
sum =0;
h = 1;
while(sum < n){
sumh = h*(h+1)/2;
sum = sumk + sumh;
if(sum == n){
break;
}
h++;
}

if(sum == n){
break;
}
k++;
}
}

if(sum == n)
System.out.print("YES");
else
System.out.print("NO");
}
}

import java.io.*;
import java.util.*;
import java.math.*;

public class P192A {

  public PrintWriter run() {
    int n = sc.nextInt() * 2;

    for (int h = (int)Math.sqrt((double)n); h > 1; h--) {
      int hRes = h * (h + 1);
      for (int l = h; l >= 1; l--) {
        int res = l * (l + 1) + hRes;
        if (res == n) {
          pw.println("YES");
          return pw;
        }
        if (res < n) {
          break;
        }
      }
    }

    pw.println("NO");
    return pw;
  }

  private Scanner sc = new Scanner(new BufferedInputStream(System.in));
  private PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));

  public static void main(String[] args) throws Exception {
    new P192A().run().close();
  }
}

import java.awt.Point;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;

import java.math.BigInteger;
import static java.math.BigInteger.*;

import java.io.*;
import java.security.PublicKey;
import java.util.*;

public class Main {

    public boolean ok(int k) {
        int n = (int)Math.sqrt((double) k);
        if (n * (n + 1) == k || n * (n - 1) == k)
            return true;
        return false;
    }
    void solve()throws Exception {
        int n = 2*nextInt();
        int e = (int) Math.sqrt((double) n);
        for (int i = 1; n - i * (i + 1) >= 0 && i <= e; ++i) {
            if (ok(n - i * (i + 1))) {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
    /*
     ***********************************************************************
     */
    PrintWriter writer;
    BufferedReader reader;

    StringTokenizer stk;

    void run()throws Exception {
        stk = null;
        reader = new BufferedReader(new InputStreamReader(System.in));
        writer = new PrintWriter(System.out);
        solve();
        reader.close();
        writer.close();
    }
    int nextInt()throws Exception {
        return Integer.parseInt(nextToken());
    }
    long nextLong()throws Exception {
        return Long.parseLong(nextToken());
    }
    double nextDouble()throws Exception {
        return Double.parseDouble(nextToken());
    }
    String nextString()throws Exception {
        return nextToken();
    }
    String nextLine()throws Exception {
        return reader.readLine();
    }
    String nextToken()throws Exception {
        if(stk == null || !stk.hasMoreTokens()) {
            stk = new StringTokenizer(nextLine());
            return nextToken();
        }
        return stk.nextToken();
    }
    public static void main(String[]args) throws Exception {
        new Main().run();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import java.util.StringTokenizer;

public class code
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main(String[] args) {
        FastReader sc=new FastReader();
        PrintWriter pw=new PrintWriter(System.out);
        HashSet<Long> set=new HashSet<>();
        ArrayList<Long> list=new ArrayList<>();
        long n=sc.nextLong();

        long sum=1;
        long h=2;
        while(sum<=1000000000)
        {
        	set.add(sum);
        	list.add(sum);
        	sum=sum+h;
        	h++;
        }
        if(set.contains(n))
        {
        	System.out.println("YES");
        	return;
        }
        for(int i=0;i<list.size();i++)
        {
        	long k=list.get(i);
        	k=n-k;
        	if(set.contains(k))
        	{
        		System.out.println("YES");
        		return;

        	}
        }
        System.out.println("NO");

            pw.flush();

        pw.close();
    }

}

import java.util.*;

public class A {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long n = sc.nextLong();
		boolean f = false;

		for (int i=0; i<Math.sqrt(n)+1; i++) {
			if ((i*(i+1))%2==0) {
				long m = n-(i*(i+1))/2;
					m *= 2;
					double i2 = -1+Math.sqrt(1+4*m);
					double i3 = -1-Math.sqrt(1+4*m);

					if ((i2%2==0 && i2>=0) ||(i3%2==0 && i3>=0) ) {
						f = true;
						break;
					}
			}
		}

		System.out.println(f ? "YES" : "NO");
	}

}

import java.util.Scanner;

public class test {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();

        double max = Math.sqrt(Math.pow(10,9));
        for(int i = 1; i< max; i++){
            double a = i*(i+1)/2;
            if (a == (int)a ){
                int b = num - (int)a;
                int temp =  (int)Math.sqrt(b * 2.0);
                if( b == temp*(temp+1)/2) {
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Triangle {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int k = 2 * Integer.parseInt(in.readLine());

		while(k > 0){
			int n = (int) Math.floor(Math.sqrt(k));
			k = k - n * (n+1);
		}

		if(k == 0){
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;

public class App {

    public static void main(String[] args) throws IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(
                System.in));
        BigInteger long1 = new BigInteger(reader.readLine());
        ArrayList<BigInteger> integers = new ArrayList<BigInteger>();
        final BigInteger MAX_VALUE = BigInteger.valueOf(1000000000L);
        for (long i = 1;; i++) {
            BigInteger integer = BigInteger.valueOf(i)
                    .multiply(BigInteger.valueOf(i + 1))
                    .divide(BigInteger.valueOf(2));
            if (integer.compareTo(MAX_VALUE) == 1) {
                break;
            }
            integers.add(integer);
        }
        int index = Collections.binarySearch(integers, (long1));

        index = Math.abs(index) - 2;
        if (index < 0) {
            System.out.println("NO");
            return;
        }
        for (int i = 0; i <= index; i++) {
            BigInteger integer = long1.subtract(integers.get(i));
            int index2 = Collections.binarySearch(integers, integer);
            if (index2 >= 0) {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");

    }
}

//package contest_121_div2;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StreamTokenizer;
import java.io.Writer;
/**
 * Date     : May 27, 2012
 * Time     : 5:46:49 PM
 * Email    : denys.astanin@gmail.com
 */

public class A {
	public static void main(String[] args) throws IOException {
		new A().run();
	}

	int nextInt() throws IOException {
		in.nextToken();
		return (int) in.nval;
	}

	String nextString() throws IOException {
		in.nextToken();
		return (String) in.sval;
	}

	StreamTokenizer in;
	Writer writer;
	Reader reader;

	void run() throws IOException {
		boolean oj = System.getProperty("ONLINE_JUDGE") != null;
		reader = oj ? new InputStreamReader(System.in, "ISO-8859-1")
				: new FileReader("src/contest_121_div2/A.txt");
		writer = new OutputStreamWriter(System.out, "ISO-8859-1");
		in = new StreamTokenizer(new BufferedReader(reader));
		PrintWriter out = new PrintWriter(writer);
		int n = nextInt();
		if (n % 2 == 0) {
			n /= 2;
			boolean is = false;
			for (int i = 1; i <= n / 2; i++) {
				long first = i * (i + 1);
				long need = n - first;
				for (int j = 1; j <= need; j++) {
					if (need == j * (j + 1) ) {
//						System.out.println(i + "!" + (i + 1) + ">>" + j + "!" + (j + 1));
						is = true;
						break;
					}
				}
				if (is)
					break;
			}
			if (is) {
				out.println("YES");
			} else {
				out.println("NO");
			}
		} else {
			out.println("NO");
		}
		out.flush();
		out.close();
	}
}

import java.util.*;

public class Main
{
    public static void main( String[] args )
    {
        Scanner in = new Scanner( System.in );
        int n = in.nextInt();
        boolean yes = false;
        for ( int i = 1; i * ( i + 1 ) <= n; i++ )
        {
            int b = n * 2 - i * ( i + 1 );
            int left = 1;
            int right = ( int ) Math.sqrt( b ) + 1;
            while ( left < right )
            {
                int mid = ( left + right ) >> 1;
                if ( mid * ( mid + 1 ) == b ) { yes = true; System.out.println( i + " " + mid ); break; }
                if ( mid * ( mid + 1 ) > b ) right = mid;
                else left = mid + 1;
            }
            if ( yes ) break;
        }
        if ( yes ) System.out.print( "YES" );
        else System.out.print( "NO" );
    }
}

import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner in = new Scanner (System.in);
        int f [] = new int [3010];
        int n=in.nextInt();

        int c=0 ;
        n=n/2;

        for (int i = 0; i < n; i++) {

            for (int j = i+1; j< n; j++) {
            int x =(i*(i+1))+(j*(j+1));

                        if(x==n)
                        {
                            System.out.println("YES");
                            return;
                        }

                    }
        }
        System.out.println("NO");

    }

}

import java.util.*;
public class d {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong(), k = 2;
        long sum = k++ * (k + 1) / 2;
        HashMap<Long, Integer> f = new HashMap<>();
        while (sum < n) {
            sum = k * (k + 1) / 2;
            f.putIfAbsent(sum, 0);
            f.putIfAbsent(n - sum, 0);
            f.put(sum, f.get(sum) + 1);
            f.put(n - sum, f.get(n - sum) + 1);
            if (f.get(n - sum) > 1 || f.get(sum) > 1) {

                System.out.println("YES");
                return;
            }
            k++;

        }

        System.out.println("NO");
    }
}

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.ArrayList;
import java.util.Collections;
import java.lang.Math;

public class Lo {
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int m = (int)Math.sqrt(n);
      String ans = "";
      for(int i = 1; i <= m; i++){
          int p = n-((i*(i+1))/2);
          int k = (int)Math.sqrt(2*p);
          if((k*(k+1))/2 == p){
              ans = "YES";
              break;
          }
      }
      System.out.println(ans=="YES"?"YES":"NO");
    }
}

import java.util.Scanner;

/**
 *
 * @author Ahmed
 */
public class FunkyNumbers {

    public static boolean isTriangularNumber(long num) {
        long calc_num = 8 * num + 1;
        long t = (long) Math.sqrt(calc_num);
        return t * t == calc_num;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String res = "NO";
        int m = (int) Math.sqrt(n * 2);
        for (int i = m; i > 0; i--) {
            if (isTriangularNumber(n - (m * (m + 1) / 2))) {
                res = "YES";
                break;
            }
        }
        //System.out.println(isTriangularNumber(14));
        System.out.println(res);
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class CoolestNumber {

    /**
     * @param args
     */
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        int n = Integer.parseInt(line);
        int sum1 = 0;
        for (int i = 1; i < n / 2; ++i) {
            sum1 += i;
            int left = n - sum1/2, temp = n - sum1/2;
            for (int j = 1; j <= temp; ++j) {
                left -= j;
                if (left == 0) {
                    System.out.println("YES");
                    return;
                }
                if (left < 0) {
                    System.out.println("NO");
                    return;
                }
            }
        }
    }
}

import java.util.*;
public class SumTw{
public static void main(String[]args){
Scanner i = new Scanner(System.in);
int n = i.nextInt();
int k =1;
int h =1;
int k1 =1;
int u = 0;
int g =0;
while((n % 2 ==0||n% 3 ==0|| n % 5==0) && n > 5){
    if(n % 2 ==0){k1++;   n = n /2; }
    else    if(n % 3 ==0){u++;   n = n /3; }
else    if(n % 5 ==0){g++;   n = n /5; }
    }
int sumk =0;
int sumh =0;
int sum =0;
while(sumk <= n/2){
if(k * (k + 1)%(int)(Math.pow(2,k1) * Math.pow(3,u) * Math.pow(5,g))==0)
sumk = k * (k + 1)/(int)(Math.pow(2,k1) * Math.pow(3,u) * Math.pow(5,g));
else{
    k++;
    continue;
    }
sum =0;
h = k;
while(sum < n){
if( h*(h + 1)%(int)(Math.pow(2,k1) * Math.pow(3,u) * Math.pow(5,g))==0)
sumh = h*(h + 1)/(int)(Math.pow(2,k1) * Math.pow(3,u) * Math.pow(5,g));
else{
    h++;
    continue;
    }

sum = sumk + sumh;
if(sum == n){
break;
}
h++;
}

if(sum == n){
break;
}
k++;
}

if(sum == n)
System.out.print("YES");
else
System.out.print("NO");

}
}

//package _121;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;
public class A
{
	public static BufferedReader br;
	public static StringTokenizer inp;
	public static PrintWriter out;
	public static void main(String[] args)  throws IOException
	{

		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);

		long t[] = new long[45000];

		int n = Integer.parseInt(br.readLine());

		for(int i = 1 ; i < 45000 ; i++)
		{
			t[i] = i*(i+1)/2;
		}
		boolean ans = false;
		for(int i = 1 ; i < 45000 ; i++)
		{
			if(t[i]>n)break;
			int temp = Arrays.binarySearch(t, n-t[i]);
			if(temp>=0){ans=true;break;}
		}
		if(ans)
			System.out.println("YES");
		else System.out.println("NO");

		br.close();
		out.close();
	}

	public static void read() throws IOException{inp = new StringTokenizer(br.readLine());}
	public static int nextInt(){return Integer.parseInt(inp.nextToken());}
	public static long nextLong(){return Long.parseLong(inp.nextToken());}
	public static double nextDouble(){return Double.parseDouble(inp.nextToken());}
	public static String next(){return inp.nextToken();}

}

import java.io.PrintWriter;
import java.util.Scanner;

public class A {
    static Scanner in; static int next() throws Exception {return in.nextInt();};
//	static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}
//	static BufferedReader in;
    static PrintWriter out;

    public static void main(String[] args) throws Exception {
        in = new Scanner(System.in);
//		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
//		in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        long p = next();
        long a[] = new long[100000];
        for (int i = 0;i < 100000;i++) a[i] = ((long)(i+2)*(long)(i+1))/2;
        int x = 0, y = 1999;
        int t = 0;

        while (x != 100000) {
            while (y >= 0 && a[x] + a[y] > p) y--;
            if (y >= 0 && a[x] + a[y] == p) {
                t++;
            }
            x++;
        }
        if (t > 0) out.println("YES");
        else out.println("NO");

        out.println();
        out.close();
    }
}

import java.util.*;
import java.io.*;
public class FunkyNumbers
{

	/************************ SOLUTION STARTS HERE ************************/

	//DONT FORGET TO COMMIT AND PUSH TO GITHUB

	private static boolean isPerfectSquare(long N)
	{
		long root = (long)(Math.sqrt(N));
		return (root * root) == N;
	}
	private static void solve(FastScanner s1, FastWriter out){

		long N = s1.nextLong();
		for(long i=1,curr = 1;curr<=N;curr = (i * (i+1) ) / 2)
		{
			long other = N - curr;
			if(isPerfectSquare(1L + (8L * other)))
			{
				out.print("YES");
				return;
			}
			i++;
		}
		out.print("NO");
	}

	/************************ SOLUTION ENDS HERE ************************/

	/************************ TEMPLATE STARTS HERE ************************/

	public static void main(String []args) throws IOException {
		FastScanner in  = new FastScanner(System.in);
		FastWriter  out = new FastWriter(System.out);
		solve(in, out);
		in.close();
		out.close();
	}

	static class FastScanner{
		public BufferedReader reader;
		public StringTokenizer st;
		public FastScanner(InputStream stream){
			reader = new BufferedReader(new InputStreamReader(stream));
			st = null;
		}
		public String next(){
			while(st == null || !st.hasMoreTokens()){
				try{
					String line = reader.readLine();
					if(line == null) return null;
					st = new StringTokenizer(line);
				}catch (Exception e){
					throw (new RuntimeException());
				}
			}
			return st.nextToken();
		}
		public String nextLine(){
			String str = null;
			try {
				str = reader.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
		public int nextInt(){
			return Integer.parseInt(next());
		}
		public long nextLong(){
			return Long.parseLong(next());
		}
		public double nextDouble(){
			return Double.parseDouble(next());
		}
		int[] nextIntArray(int n) {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}

		long[] nextLongArray(int n) {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLong();
			}
			return arr;
		}
		public void close(){
			try{ reader.close(); } catch(IOException e){e.printStackTrace();}
		}
	}
	static class FastWriter{
		BufferedWriter writer;
		public FastWriter(OutputStream stream){
			writer = new BufferedWriter(new OutputStreamWriter(stream));
		}
		public void print(int i) {
			print(Integer.toString(i));
		}
		public void println(int i) {
			print(Integer.toString(i));
			print('\n');
		}
		public void print(long i) {
			print(Long.toString(i));
		}
		public void println(long i) {
			print(Long.toString(i));
			print('\n');
		}
		public void print(double i) {
			print(Double.toString(i));
		}
		public void print(boolean i) {
			print(Boolean.toString(i));
		}
		public void print(Object o){
			print(o.toString());
		}
		public void println(Object o){
			print(o.toString());
			print('\n');
		}
		public void print(char i) {
			try{writer.write(i);} catch(IOException e){e.printStackTrace();}
		}
		public void print(String s){
			try{writer.write(s);} catch(IOException e){e.printStackTrace();}
		}
		public void println(String s){
			try{writer.write(s);writer.write('\n');} catch(IOException e){e.printStackTrace();}
		}
		public void println(){
			try{writer.write('\n');} catch(IOException e){e.printStackTrace();}
		}
		public void print(int arr[])
		{
			for (int i = 0; i < arr.length; i++) {
				print(arr[i]);
				print(' ');
			}
		}
		public void close(){
			try{writer.close();} catch(IOException e){e.printStackTrace();}
		}
	}

	/************************ TEMPLATE ENDS HERE ************************/
}

import java.util.Arrays;
import java.util.Scanner;

public class Prob192A {
	public static void main(String[] Args) {
		Scanner in = new Scanner(System.in);
		int terms = (int) Math.sqrt(2000000000);
		int[] array = new int[terms + 3];
		for (int i = 0; i < array.length; i++)
			array[i] = i * (i + 1) / 2;

		int number = in.nextInt();
		boolean ok = false;
		for (int i = 0; i < array.length; i++)
			if (Arrays.binarySearch(array, number - array[i]) >= 0)
				ok = true;

		System.out.println(ok ? "YES" : "NO");
	}
}

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class ModalNumbers {

	public static boolean arrayContainsNumber(int[] array, int fromIndex, int toIndex, int key) {
		int insertionIndex = Arrays.binarySearch(array, fromIndex, toIndex, key);
		return insertionIndex >= 0 && array[insertionIndex] == key;
	}

		public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int[] tringleNumbers = new int[100000];
		for (int i = 1; i < N; i++) {
			tringleNumbers[i] = i * (i + 1) / 2;
		}
		boolean foundSolution = false;
		for (int i = 1; i < Math.sqrt(N); i++) {
			if (arrayContainsNumber(tringleNumbers, i, (int)Math.sqrt(N) + 1, N - tringleNumbers[i])) {
				foundSolution = true;
			}
		}
		PrintWriter out = new PrintWriter(System.out);
		out.println(foundSolution ? "YES" : "NO");
		out.flush();
	}

}

import java.io.*;
import java.util.*;

public class a121
{
	public static void main(String[] args) throws Exception
	{
		InputReader in = new InputReader(System.in);
		OutputWriter out = new OutputWriter(System.out);
		int n=in.readInt();
		int a[]=new int[(int)Math.sqrt(n*2)+2];
		for(int i=0;i<=(int)Math.sqrt(n*2)+1;i++)
		a[i]=(i*(i+1))/2;

		int flag=0;
		for(int i=0;i<=(int)Math.sqrt(n*2)+1;i++)
		{
			int left=i,right=(int)Math.sqrt(n*2)+1,mid;
				while (left < right)
				{
					mid = left + (right - left) / 2;
					if(a[i]+a[mid]>=n)
					{
						right=mid;}//out.printLine(s(mid,k));}
					else
						left=mid+1;
				}
				if(a[left]+a[i]==n){
				out.printLine("YES");flag=1;break;}
			}
				if(flag==0)
				out.printLine("NO");
		out.close();
	}

	private static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int read()
		{
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				} catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (numChars <= 0)
				return -1;
			}
			return buf[curChar++];
		}
		public int readInt()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public long readLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
		public String readString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter
		{
			public boolean isSpaceChar(int ch);
		}
	}

	private static class OutputWriter
	{
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream)
		{
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer)
		{
			this.writer = new PrintWriter(writer);
		}
 		public void print(Object... objects)
		{
			for (int i = 0; i < objects.length; i++)
			{
				if (i != 0)
				writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void printLine(Object... objects)
		{
			print(objects);
			writer.println();
		}

		public void close()
		{
			writer.close();
		}

		public void flush()
		{
			writer.flush();
		}

	}
}

import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class Tests{
	static Scanner in = new Scanner (System.in);
	static PrintWriter out = new PrintWriter (System.out);

	static TreeSet <Long> set = new TreeSet <Long>();

	public static void main (String []args) {
		int n = in.nextInt();

		for(long i = 0 ; i<100000; i++){
			set.add((i*(i+1)/2));
		}

		for(long i : set){
			if(set.contains(n-i)) {
				out.println("YES");
				out.flush();
				System.exit(0);
			}
		}
		out.println("NO");

		out.flush();
		out.close();

	}

}

import java.io.*;
import java.util.*;

public class test2
{

	public static void main(String[] args) throws Exception
	{
		new test2().run();
	}

	PrintWriter out = null;

	void run() throws Exception
	{
		Scanner in = new Scanner(System.in);
		out = new PrintWriter(System.out);

		int n = in.nextInt();

		int i = 1;
		int sum = 1;

		HashSet<Integer> hs = new HashSet<Integer>();
		while (sum <= n / 2 + 1)
		{
			hs.add(sum);
			i++;
			sum += i;
		}

		for (i = 1; i <= n / 2 + 1; i++)
		{
			if (hs.contains(i) && hs.contains(n - i))
				break;
		}

		if (i <= n / 2)
			out.println("YES");
		else
			out.println("NO");

		out.close();
	}
}

        import java.io.*;
        import java.util.*;
        import java.math.*;
        import java.lang.*;

        public class Main implements Runnable
        {
            static class InputReader
            {
                private InputStream stream;
                private byte[] buf = new byte[1024];
                private int curChar;
                private int numChars;
                private SpaceCharFilter filter;
                private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

                public InputReader(InputStream stream)
                {
                    this.stream = stream;
                }

                public int read()
                {
                    if (numChars==-1)
                        throw new InputMismatchException();

                    if (curChar >= numChars)
                    {
                        curChar = 0;
                        try
                        {
                            numChars = stream.read(buf);
                        }
                        catch (IOException e)
                        {
                            throw new InputMismatchException();
                        }

                        if(numChars <= 0)
                            return -1;
                    }
                    return buf[curChar++];
                }

                public String nextLine()
                {
                    String str = "";
                    try
                    {
                        str = br.readLine();
                    }
                    catch (IOException e)
                    {
                        e.printStackTrace();
                    }
                    return str;
                }
                public int nextInt()
                {
                    int c = read();

                    while(isSpaceChar(c))
                        c = read();

                    int sgn = 1;

                    if (c == '-')
                    {
                        sgn = -1;
                        c = read();
                    }

                    int res = 0;
                    do
                    {
                        if(c<'0'||c>'9')
                            throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = read();
                    }
                    while (!isSpaceChar(c));

                    return res * sgn;
                }

                public long nextLong()
                {
                    int c = read();
                    while (isSpaceChar(c))
                        c = read();
                    int sgn = 1;
                    if (c == '-')
                    {
                        sgn = -1;
                        c = read();
                    }
                    long res = 0;

                    do
                    {
                        if (c < '0' || c > '9')
                            throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = read();
                    }
                    while (!isSpaceChar(c));
                        return res * sgn;
                }

                public double nextDouble()
                {
                    int c = read();
                    while (isSpaceChar(c))
                        c = read();
                    int sgn = 1;
                    if (c == '-')
                    {
                        sgn = -1;
                        c = read();
                    }
                    double res = 0;
                    while (!isSpaceChar(c) && c != '.')
                    {
                        if (c == 'e' || c == 'E')
                            return res * Math.pow(10, nextInt());
                        if (c < '0' || c > '9')
                            throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = read();
                    }
                    if (c == '.')
                    {
                        c = read();
                        double m = 1;
                        while (!isSpaceChar(c))
                        {
                            if (c == 'e' || c == 'E')
                                return res * Math.pow(10, nextInt());
                            if (c < '0' || c > '9')
                                throw new InputMismatchException();
                            m /= 10;
                            res += (c - '0') * m;
                            c = read();
                        }
                    }
                    return res * sgn;
                }

                public String readString()
                {
                    int c = read();
                    while (isSpaceChar(c))
                        c = read();
                    StringBuilder res = new StringBuilder();
                    do
                    {
                        res.appendCodePoint(c);
                        c = read();
                    }
                    while (!isSpaceChar(c));

                    return res.toString();
                }

                public boolean isSpaceChar(int c)
                {
                    if (filter != null)
                        return filter.isSpaceChar(c);
                    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
                }

                public String next()
                {
                    return readString();
                }

                public interface SpaceCharFilter
                {
                    public boolean isSpaceChar(int ch);
                }
            }
            public static void main(String args[]) throws Exception
            {
                new Thread(null, new Main(),"Main",1<<27).start();
            }

            static class Pair{
                int f;
                int s;
                //boolean n;

                Pair(int f,int s){
                    this.f=f;
                    this.s=s;
                    //this.n = n;

                }

                public static Comparator<Pair> wc = new Comparator<Pair>(){
                    public int compare(Pair e1,Pair e2){

                        //reverse order
                        //if(e1.n)return 1;
                        //else if(e2.n) return -1;
                        if(e1.s < e2.s)
                            return -1;  // 1 for swaping.
                        else if (e1.s > e2.s)
                            return 1;
                        else {
                            return 0;
                        }

                    }
                };
            }

            public static long gcd(long a,long b){
                if(b==0)return a;
                else return gcd(b,a%b);
            }

            ////recursive BFS
            public static int bfsr(int s,ArrayList<Integer>[] a,boolean[] b,int[] pre){
                b[s]=true;
                int p = 1;
                int n = pre.length -1;
                int t = a[s].size();
                int max = 1;
                for(int i=0;i<t;i++){
                    int x = a[s].get(i);
                    if(!b[x]){
                        //dist[x] = dist[s] + 1;
                        int xz =  (bfsr(x,a,b,pre));
                        p+=xz;
                        max = Math.max(xz,max);
                    }
                }
                //max = Math.max(max,(n-p));
                pre[s] = max;
                return p;
            }

        //// iterative BFS
            public static int bfs(int s,ArrayList<Integer>[] a,int dist,boolean[] b,PrintWriter w){
                b[s]=true;
                int siz = 0;
                dist--;
                Queue<Integer> q = new LinkedList<>();
                q.add(s);
                while(q.size()!=0 && dist>0 ){
                    int i=q.poll();
                    Iterator<Integer> it = a[i].listIterator();
                    int z=0;
                    while(it.hasNext() && dist>0){
                        z=it.next();
                        if(!b[z]){
                            b[z]=true;
                            dist--;
                            //dist[z] = dist[i] + 1;
                            siz++;
                            q.add(z);
                        }
                    }

                }
                return siz;
            }

            public static int lower(int key, int[] a){
                int l = 0;
                int r = a.length-1;
                int res = 0;

                while(l<=r){
                    int mid = (l+r)/2;

                    if(a[mid]<=key){
                        l = mid+1;
                        res = mid+1;
                    }
                    else{
                        r = mid -1;
                    }
                }

                return res;
            }

        //////////////////////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////////////////////

            public void run()
            {
                InputReader sc = new InputReader(System.in);
                PrintWriter w = new PrintWriter(System.out);
                long defaultValue=0;

                // int tc = sc.nextInt();
                // while(tc-->0){
                    long n = sc.nextLong();
                    HashMap<Long,Boolean> h = new HashMap<Long,Boolean>();
                    for(long i=1;i<100001;i++){
                        h.put( ((i*(i+1))/2), true);
                    }
                    boolean f = false;
                    for(long i=1;i<100001;i++){
                       long x = (i*(i+1))/2;
                        if(h.getOrDefault((n-x), false)){
                            w.println((n-x));
                            f = true;
                            break;
                        }
                    }
                    if(f)
                    w.println("YES");
                    else
                    w.println("NO");

                //}
                w.flush();
                w.close();
            }

        }

import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

    public class Test {
            public static void main(String args[]){
            	Scanner input = new Scanner(System.in);
                   	long n = input.nextInt();
                    System.out.println(maximum(n));
            }

          public static String maximum(long n){
        	  for(long i = 1 ; i < (Math.sqrt(n)*5);  i++){
        		  long j = (long)Math.sqrt(((n-(i*(i+1))/2))*2);
    			  while(((i*(i+1))+(j*(j+1)))/2 <= n){
        			  if(((i*(i+1))+(j*(j+1)))/2 == n){
        				  return "YES";
        			  }
        			  j+= Math.sqrt(n-((i*(i+1))+(j*(j+1)))/2);
        		  }
        	  }
        	  return "NO";

          }

    }

import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class FunkyNumbers implements Closeable {

    private InputReader in = new InputReader(System.in);
    private PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out), true);

    public void solve() {
        int n = in.ni();
        int limit = (int) Math.sqrt(2 * n);
        int[] seed = new int[limit];
        for (int i = 1; i <= limit; i++) {
            seed[i - 1] = i * (i + 1) / 2;
        }
        for (int i = 0; i < limit - 1; i++) {
            for (int j = i + 1; j < limit; j++) {
                if (seed[i] + seed[j] == n) {
                    out.println("YES");
                    return;
                }
            }
        }
        out.println("NO");
    }

    @Override
    public void close() throws IOException {
        in.close();
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ni() {
            return Integer.parseInt(next());
        }

        public long nl() {
            return Long.parseLong(next());
        }

        public void close() throws IOException {
            reader.close();
        }
    }

    public static void main(String[] args) {
        new FunkyNumbers().solve();
    }
}

import java.io.PrintWriter;
import java.util.Scanner;

public class A {
    static Scanner in; static int next() throws Exception {return in.nextInt();};
//	static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}
//	static BufferedReader in;
    static PrintWriter out;

    public static void main(String[] args) throws Exception {
        in = new Scanner(System.in);
//		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
//		in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        long p = next();
        long a[] = new long[2000];
        for (int i = 0;i < 2000;i++) a[i] = ((long)(i+2)*(long)(i+1))/2;
        int x = 0, y = 1999;
        int t = 0;

        while (x != 2000) {
            while (y >= 0 && a[x] + a[y] > p) y--;
            if (y >= 0 && a[x] + a[y] == p) {
                t++;
            }
            x++;
        }
        if (t > 0) out.println("YES");
        else out.println("NO");

        out.println();
        out.close();
    }
}

import java.util.Scanner;

public class FunkyNumber {

    public static void main(String[] args) {
        Scanner inp = new Scanner(System.in);
        int n = inp.nextInt();
        for (int i = 0; i < n; i++) {
            if(sol(1, -1, (i+1)*i-2*n)){
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
     static  boolean sol(int  a,int b, int c){
          if(b*b>=4*a*c){
              double x1 = -b+Math.sqrt(b*b-4*a*c);
              if(Math.ceil(x1)==x1){
                  return true;
              }
              else
                  return false;
          }
          return false;
     }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by saksham on 11-08-2016.
 * 192A
 */
public class FunkyNumbers {
    public static void main(String []args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int num = Integer.parseInt(br.readLine());
        if(num < 6) {
            System.out.println("NO");
            return;
        }
        int[] arr = new int[50000];
        int i = 0, maxIndex = 0;
        arr[0] = 0;
        for(i = 1; arr[i-1] <= num; i++) {
            arr[i] = arr[i-1] + i;
            maxIndex = i;
        }
//        System.out.println(maxIndex);
//        for(i = 0; i <= maxIndex; i++) {
//            System.out.print(arr[i] + " ");
//        }
//        System.out.println();
        maxIndex--;
        while(maxIndex > 0) {
            i = 1;
            while (arr[i] + arr[maxIndex] <= num) {
//                System.out.println((arr[i] + arr[maxIndex - 1]) + " " + arr[i] + " " + arr[maxIndex - 1]);
                if (arr[i] + arr[maxIndex] == num) {
                    System.out.println("YES");
                    return;
                }
                i++;
            }
            maxIndex--;
        }
        System.out.println("NO");
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;

public class App {

    public static void main(String[] args) throws IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(
                System.in));
        BigInteger long1 = new BigInteger(reader.readLine());
        if (long1.compareTo(BigInteger.ONE) == 0
                || long1.compareTo(BigInteger.valueOf(3)) == 0) {
            System.out.println("NO");
            return;
        }
        ArrayList<BigInteger> integers = new ArrayList<BigInteger>();
        final BigInteger MAX_VALUE = BigInteger.valueOf(1000000000L);
        for (long i = 1;; i++) {
            BigInteger integer = BigInteger.valueOf(i)
                    .multiply(BigInteger.valueOf(i + 1))
                    .divide(BigInteger.valueOf(2));
            if (integer.compareTo(MAX_VALUE) == 1) {
                break;
            }
            integers.add(integer);
        }
        int index = Collections.binarySearch(integers, (long1));
        if (index < 0) {
            index = Math.abs(index) - 2;
            if (index < 0) {
                System.out.println("NO");
                return;
            }
            for (int i = 0; i <= index; i++) {
                BigInteger integer = long1.subtract(integers.get(i));
                if (Collections.binarySearch(integers, integer) >= 0) {
                    System.out.println("YES");
                    return;
                }
            }
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }
}

import java.io.PrintWriter;
import java.util.Scanner;

public class A {
    static Scanner in; static int next() throws Exception {return in.nextInt();};
//	static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}
//	static BufferedReader in;
    static PrintWriter out;

    public static void main(String[] args) throws Exception {
        in = new Scanner(System.in);
//		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
//		in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        long p = next();
        long a[] = new long[2000];
        for (int i = 0;i < 2000;i++) a[i] = (i*(i+1))/2;
        int x = 0, y = 1999;

        for (x = 0;y >=0&&x < 2000&&a[x]+a[y] != 0;x++) {
            while (y >= 0&&a[x] + a[y] > p) y--;
        }
        if (x == 2000 || a[x-2]==p) out.println("NO");
        else out.println("YES");

        out.println();
        out.close();
    }
}

import java.util.*;
import java.io.*;
import java.math.*;
import java.awt.*;
public class FunkyNumbers
{
    static final int INF = Integer.MAX_VALUE;
    static final int NINF = Integer.MIN_VALUE;

    public static void main(String[]args)throws IOException
    {
        Input in = new Input();
        int n = in.nextInt();
        ArrayList<Integer> tris = new ArrayList<Integer>();
        int i = 0;
        while(i*(i+1)/2 <= 1000000000)
        {
            tris.add(i*(i+1)/2);
            i++;
        }

        Integer [] arr = tris.toArray(new Integer[0]);

        for(i = 0; i < arr.length; i++)
        {
            if(Arrays.binarySearch(arr, n-arr[i]) >= 0)
            {
                System.out.println("YES");
                exit();
            }
        }
        System.out.println("NO");
    }

    public static void exit()
    {
        System.exit(0);
    }
}

class Input
{
    BufferedReader br;
    StringTokenizer st;

    public Input()
    {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    public String nextLine()throws IOException
    {
        StringBuilder sb = new StringBuilder();
        if(st == null)
            st = new StringTokenizer(br.readLine());
        if(!st.hasMoreTokens())
        {
            st = new StringTokenizer(br.readLine());
            return "";
        }

        while(st.hasMoreTokens())
        {
            sb = sb.append(st.nextToken());
            if(st.hasMoreTokens())
              sb = sb.append(" ");
        }
        st = new StringTokenizer(br.readLine());
        return sb.toString();
    }

    public int nextInt()throws IOException
    {
        return Integer.parseInt(next());
    }

    public long nextLong()throws IOException
    {
        return Long.parseLong(next());
    }

    public float nextFloat()throws IOException
    {
        return Float.parseFloat(next());
    }

    public double nextDouble()throws IOException
    {
        return Double.parseDouble(next());
    }

    public String next()throws IOException
    {
        if(st == null || !st.hasMoreTokens())
          st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }
}

import java.io.*;
import java.util.*;

public class funky_numbers
{
	boolean binSearch(long [] a, long find)
	{
		int lo = 0;
		int hi = a.length-1;
		while (lo <= hi)
		{
			int mid = (lo+hi)/2;
			if (a[mid] < find)
				lo = mid+1;
			else if (a[mid] > find)
				hi = mid - 1;
			else return true;

		}

		return false;
	}

	public static void main(String args[])throws IOException
	{
		Scanner sc = new Scanner(System.in);
		funky_numbers fn = new funky_numbers();

		long n = sc.nextLong();
		int nsqrt =(int) Math.sqrt(2*n);

		long [] triang = new long[nsqrt+1];
		for (int i = 1; i<= nsqrt; i++)
			triang[i] = i*(i+1)/2;

		if (n == 1)
			System.out.println("NO");
		else
		{
			Arrays.sort(triang);
			for (int i = 1; i< triang.length; i++)
			{
				long find = n - triang[i];
				if (fn.binSearch(triang, find)==true)
				{	System.out.println("YES");return;}

			}
			System.out.println("NO");
		}

	}

}

import java.io.PrintWriter;
import java.util.Scanner;

public class A {
    static Scanner in; static int next() throws Exception {return in.nextInt();};
//	static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}
//	static BufferedReader in;
    static PrintWriter out;

    public static void main(String[] args) throws Exception {
        in = new Scanner(System.in);
//		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
//		in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        long p = next();
        long a[] = new long[2000];
        for (int i = 0;i < 2000;i++) a[i] = ((i+2)*(i+1))/2;
        int x = 0, y = 1999;
        int t = 0;

        while (x != 2000&&y >=0) {
            while (y >= 0 && a[x] + a[y] > p) y--;
            if (y >= 0 && a[x] + a[y] == p) {
                t++;
            }
            x++;
            if (y!=1999)y++;
        }
        if (t > 0) out.println("YES");
        else out.println("NO");

        out.println();
        out.close();
    }
}

import java.util.Scanner;

public class B {

	public static int funky(int n) {
		return n*(n+1)/2;
	}

	public static void main(String[] args) {

		//Input de consola

		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());

		//Programa

		int mid = (int) Math.floor((-1+Math.sqrt(1+4*n))/2);

		while(funky(mid)<n) {
			mid++;
		}

		mid--;
		int comp = 1;

		while(funky(mid)+funky(comp)<n) {
			comp++;
		}

		if(funky(mid)+funky(comp)==n) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}

	}

}

/**
 * Created with IntelliJ IDEA.
 * User: Zakhar_Voit
 * Date: 28.05.12
 * Time: 1:52
 */

import java.io.*;
import java.util.*;

import static java.lang.System.exit;

public class A {
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    int n;
    boolean ans = false;

    void init() {

    }

    void read() throws IOException {
        n = nextInt();
    }

    void solve() {
        for (int i = 1; i < 65530; i++) {
            int x = i*(i + 1)/2, y = n - x;
            if ((-1.0 + Math.sqrt(1.0 + 8.0*y))/2.0 == Math.floor((-1.0 + Math.sqrt(1.0 + 8.0*y))/2.0) || (-1.0 - Math.sqrt(1.0 + 8.0*y))/2.0 == Math.floor((-1.0 - Math.sqrt(1.0 + 8.0*y))/2.0)) {
                out.println("YES");
                return;
            }
        }
        out.println("NO");
    }

    void write() {

    }

    public void run() throws IOException {
        openIO();
        init();
        read();
        solve();
        write();
        out.close();
    }

    static public void main(String[] args) throws IOException {
        new Thread(null, new Runnable() {
            public void run() {
                try {
                    new A().run();
                } catch (Throwable e) {
                    e.printStackTrace();
                    exit(999);
                }
            }
        }, "1", 1 << 23).start();
    }

    public void openIO() throws IOException {
        if (new File("input.txt").exists()) {
            System.setIn(new FileInputStream("input.txt"));
            out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
        } else {
            out = new PrintWriter(System.out);
        }
        in = new BufferedReader(new InputStreamReader(System.in));
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextLine() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

    boolean EOF() throws IOException {
        while (!st.hasMoreTokens()) {
            String s = in.readLine();
            if (s == null)
                return true;
            st = new StringTokenizer(s);
        }
        return false;
    }
}

import java.io.*;
import java.util.*;

public class funky_numbers
{
	boolean binSearch(long [] a, long find)
	{
		int lo = 0;
		int hi = a.length-1;
		while (lo <= hi)
		{
			int mid = (lo+hi)/2;
			if (a[mid] < find)
				lo = mid+1;
			else if (a[mid] > find)
				hi = mid - 1;
			else return true;

		}

		return false;
	}

	public static void main(String args[])throws IOException
	{
		Scanner sc = new Scanner(System.in);
		funky_numbers fn = new funky_numbers();

		long n = sc.nextLong();
		int nsqrt =(int) Math.sqrt(2*n);
		long [] triang = new long[nsqrt+5];
		for (int i = 1; i<= nsqrt; i++)
			triang[i] = i*(i+1)/2;

		Arrays.sort(triang);
		for (int i = 1; i< triang.length; i++)
		{
			long find = n - triang[i];
			if (fn.binSearch(triang, find)==true)
			{	System.out.println("YES");return;}

		}
		System.out.println("NO");

	}

}

import java.util.Scanner;

public class FunkyNumber {

    public static void main(String[] args) {
        Scanner inp = new Scanner(System.in);
        int n = inp.nextInt();
        for (int i = 0; i < Math.sqrt(n); i++) {
            if(sol(1, -1, (i+1)*i-2*n)){
                System.out.println("YES");
                System.out.println(i);
                return;
            }
        }
        System.out.println("NO");
    }
     static  boolean sol(int  a,int b, int c){
          if(b*b>=4*a*c){
              double x1 = -b+Math.sqrt(b*b-4*a*c);
              if(Math.ceil(x1)==x1){
                  return true;
              }
              else
                  return false;
          }
          return false;
     }
}

import java.util.*;
import java.io.*;
public class Funky  {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		List<Long> hash_Set = new ArrayList<Long>();
		long n = sc.nextLong();
		long res = 0;
		long dif = 0;

		boolean encontrado=false;

		for (long i = 0; i < 50000000; i++) {
			res=calcular(i);
			hash_Set.add(res);

			if (res>=50000000) {
				i=50000000;
			}
		}

		for (int i = 0; i < hash_Set.size(); i++) {
			dif = n - hash_Set.get(i);

			if (hash_Set.contains(dif)) {
				encontrado=true;
			}
		}

		if (encontrado) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}
	public static long calcular(long n) {
		long res=0;
		res= (n*(n+1))/2;
		return res;
	}
}

//package contest_121_div2;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StreamTokenizer;
import java.io.Writer;
/**
 * Date     : May 27, 2012
 * Time     : 5:46:49 PM
 * Email    : denys.astanin@gmail.com
 */

public class A {
	public static void main(String[] args) throws IOException {
		new A().run();
	}

	int nextInt() throws IOException {
		in.nextToken();
		return (int) in.nval;
	}

	String nextString() throws IOException {
		in.nextToken();
		return (String) in.sval;
	}

	StreamTokenizer in;
	Writer writer;
	Reader reader;

	void run() throws IOException {
		boolean oj = System.getProperty("ONLINE_JUDGE") != null;
		reader = oj ? new InputStreamReader(System.in, "ISO-8859-1")
				: new FileReader("src/contest_121_div2/A.txt");
		writer = new OutputStreamWriter(System.out, "ISO-8859-1");
		in = new StreamTokenizer(new BufferedReader(reader));
		PrintWriter out = new PrintWriter(writer);
		int n = nextInt();
		if (n % 2 == 0) {
			n /= 2;
			boolean is = false;
			for (int i = 1; i * (i + 1) <= n; i++) {
				long first = i * (i + 1);
				long need = n - first;
				int j = 1;
				while (j * (j + 1) <= need) {
					if (need == j * (j + 1) ) {
//						System.out.println(i + "!" + (i + 1) + ">>" + j + "!" + (j + 1));
						is = true;
						break;
					}
					j++;
				}
				if (is)
					break;
			}
			if (is) {
				out.println("YES");
			} else {
				out.println("NO");
			}
		} else {
			out.println("NO");
		}
		out.flush();
		out.close();
	}
}

import java.io.*;
import java.util.*;

public class FunkyNumbers
{

    public static void main(String[] args)
    {
        Scanner in=new Scanner(System.in);
        long n = in.nextLong();

        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                if ((i*(i+1)/2)+(j*(j+1)/2)==n)
                {
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");

    }

}

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Task192A {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {
		private static boolean isTriangle(int n) {
			int cand = (int) Math.sqrt(2 * n);
			return cand * (cand + 1) == n;
		}

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			boolean answer = false;

			for (int k = 1; k * (k + 1) / 2 < n; k++) {
				if (isTriangle(n - k * (k + 1) / 2)) {
					answer = true;
					break;
				}
			}

			pw.println(answer ? "YES" : "NO");

			s.close();
			pw.flush();
		}

	}

}

import java.util.*;
public class d {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong(), k = 2;
        long sum = k++ * (k + 1) / 2;
        HashMap<Long, Integer> f = new HashMap<>();
        while (sum < n) {
            sum = k * (k + 1) / 2;
            f.putIfAbsent(sum, 0);
            f.putIfAbsent(n - sum, 0);
            f.put(sum, f.get(sum) + 1);
            f.put(n - sum, f.get(n - sum) + 1);
            if (f.get(n - sum) > 1 || f.get(sum) > 1) {

                System.out.println("YES");
                return;
            }
            k++;

        }

        System.out.println("NO");
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author toghru
 */
public class Main {

    public static void main(String[] args) throws InterruptedException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        PrintWriter out = new PrintWriter(outputStream);
        InputReader in = new InputReader(inputStream);

        long n = in.nextLong();

        for(long i = 0; i <= 100000; i++) {
            long l = 1, r = 10000;
            long m;
            while(l <= r) {
                m = (l + r) / 2;
                if(i * (i + 1) / 2 + m * (m + 1) / 2 == n) {
                    out.println("YES");
                    out.close();
                    return;
                }else if(i * (i + 1) / 2 + m * (m + 1) / 2 < n) {
                    l = m + 1;
                }else {
                    r = m - 1;
                }
            }
        }

        out.println(n != 0 ? "NO" : "YES");
        out.close();
    }

    static class InputReader {

        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream), 32624);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException ex) {
                    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        private long nextLong() {
            return Long.parseLong(next());
        }

        private BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
    }

}

import java.util.Scanner;

public class Funky_num {
	public static String is_num(int n) {

		if( n== 1 || n == 5 || n==10) {
			return "NO";

		}else if( n== 2 || n == 6 || n==4) {
			return "YES";
		}
		else if(n >= 7) {
			//define f(x) ((x*(x+1))/2)

			  //long n=0;
			  long  x=0, y=0;
			  long formula_x;
			  long formula_y;

			  for(x=0; x<=Math.sqrt(n); x++){
			  	formula_x= (x*(x+1))/2;
			    y = (long)(Math.sqrt((n-formula_x)*2));
			    formula_y= (y*(y+1))/2;
			    if(formula_y+ formula_x ==n){
			    	return "YES";
			    }
			  }
			  return "NO";
		}
		return "NO";
	}

	  public static void main(String args[]){
	        Scanner res = new Scanner(System.in);

	        int x = res.nextInt();

	        System.out.println(is_num(x));
	        res.close();

	    }
}

import java.util.Arrays;
import java.util.Scanner;

public class first {

    /**
     * @param args
     */

    public static void main(String[] args) {
    long n;
    Scanner Sc=new Scanner(System.in);
    n=Sc.nextLong();
    n*=2;
    long r=(long)Math.sqrt((n));
    if (r*(r+1)>n)
        r--;
    long l=1;
    boolean ans=false;
    while (l<r)
    {
        long p=l*(l+1)+(r-1)*r;
        if (p==n)
        {
            ans=true;
            break;
        }
        else
            if (p<n)
                l++;
            else
                r--;
    }
    if (ans==false)
        System.out.print("NO");
    else
        System.out.print("YES");
    System.out.flush();

}
}

import java.util.*;
import java.io.*;

public class Main {
  static Graph g;
  static int n;
  static int[] arr;

    public static void main(String[] args) {

        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        int n = in.nextInt();
        List<Integer> l=getList();
        boolean check = false;
        for (int i=0;i<l.size();i++)
        {
            for (int j=i+1;j<l.size();j++)
                if (l.get(i)+l.get(j)==n)
                {
                    check = true;
                    break;
                }
        }
        out.printLine(check?"YES":"NO");

        out.flush();

    }
    static List<Integer> getList()
    {
        List<Integer> l = new ArrayList<>();
        int i=1;
        while(true)
        {
            int k = (i+1)*i;
            k/=2;
            if (k>1e5)
                break;
            else
                l.add(k);
            i++;
        }
        return l;
    }

}

class Graph {

    int n;
    LinkedList<Integer>[] adjList;

    public Graph(int n) {
        this.n = n;
        adjList = new LinkedList[n];
        for (int i = 0; i < n; i++)
            adjList[i] = new LinkedList<>();
    }

}

class InputReader {

    private final InputStream stream;
    private final byte[] buf = new byte[8192];
    private int curChar, snumChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (snumChars == -1)
            throw new InputMismatchException();
        if (curChar >= snumChars) {
            curChar = 0;
            try {
                snumChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (snumChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int nextInt() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long nextLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public int[] nextIntArray(int n) {
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public String nextLine() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndOfLine(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

    public void flush() {
        writer.flush();
    }

}

public class Main
{
    public static void main (String[]args)
    {
        java.util.Scanner inp = new java.util.Scanner(System.in);
        int x = inp.nextInt();
        int y = 2 * x;
        int f = (int)Math.sqrt(y);
        for(int i = 1;i <= f;i++){
            if(((i*(i+1))+(i * (i+1))) > (y))
            break;
            for(int k = f;k >= (i+1);k--){
                if(((i*(i+1))+(k * (k+1))) < y  ){
                    break;
                }
                if( (y) == ((i*(i+1))+(k * (k+1)))){
                    System.out.println("YES");
                    System.exit(0);
                }
            }
        }
        System.out.println("NO");
    }
}

import java.util.Scanner;

public class CFR121A {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long n = in.nextLong();
		String ans = "NO";
		double k2;
		int t1 = 0;
		long mk1 = Math.round(2*Math.sqrt(n));
		for(int k1=1; k1<mk1; k1++){
			t1 += k1;
			k2 = 0.5*(-1+Math.sqrt(1 + 8*(n-t1)));
			if(k2 > 0 && Math.round(k2) - k2 == 0){
				ans = "YES";
				System.out.println("k1 = " + k1 + " k2 = " + k2 + " n = " + 0.5*(k1*(k1+1)+k2*(k2+1)));
			}

		}

		System.out.println(ans);

	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author toghru
 */
public class Main {

    public static void main(String[] args) throws InterruptedException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        PrintWriter out = new PrintWriter(outputStream);
        InputReader in = new InputReader(inputStream);

        long n = in.nextLong();

        for(long i = 0; i <= 10000; i++) {
            long l = 1, r = 10000;
            long m;
            while(l <= r) {
                m = (l + r) / 2;
                if(i * (i + 1) / 2 + m * (m + 1) / 2 == n) {
                    out.println("YES");
                    out.close();
                    return;
                }else if(i * (i + 1) / 2 + m * (m + 1) / 2 < n) {
                    l = m + 1;
                }else {
                    r = m - 1;
                }
            }
        }

        out.println(n != 0 ? "NO" : "YES");
        out.close();
    }

    static class InputReader {

        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream), 32624);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException ex) {
                    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        private long nextLong() {
            return Long.parseLong(next());
        }

        private BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
    }

}

import java.util.*;
import java.io.*;
public class FunkyNumbers
{

	/************************ SOLUTION STARTS HERE ************************/

	//DONT FORGET TO COMMIT AND PUSH TO GITHUB

	private static boolean isPerfectSquare(long N)
	{
		long root = (long)(Math.sqrt(N));
		return (root * root) == N;
	}
	private static void solve(FastScanner s1, FastWriter out){

		long N = s1.nextLong();
		if(N == 1)
		{
			out.print("NO");
			return;
		}
		for(long i=1,curr = 1;curr<=N;curr = (i * (i+1) ) / 2)
		{
			long other = N - curr;
			if(isPerfectSquare(1L + (8L * other)))
			{
				out.print("YES");
				return;
			}
			i++;
		}
		out.print("NO");
	}

	/************************ SOLUTION ENDS HERE ************************/

	/************************ TEMPLATE STARTS HERE ************************/

	public static void main(String []args) throws IOException {
		FastScanner in  = new FastScanner(System.in);
		FastWriter  out = new FastWriter(System.out);
		solve(in, out);
		in.close();
		out.close();
	}

	static class FastScanner{
		public BufferedReader reader;
		public StringTokenizer st;
		public FastScanner(InputStream stream){
			reader = new BufferedReader(new InputStreamReader(stream));
			st = null;
		}
		public String next(){
			while(st == null || !st.hasMoreTokens()){
				try{
					String line = reader.readLine();
					if(line == null) return null;
					st = new StringTokenizer(line);
				}catch (Exception e){
					throw (new RuntimeException());
				}
			}
			return st.nextToken();
		}
		public String nextLine(){
			String str = null;
			try {
				str = reader.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
		public int nextInt(){
			return Integer.parseInt(next());
		}
		public long nextLong(){
			return Long.parseLong(next());
		}
		public double nextDouble(){
			return Double.parseDouble(next());
		}
		int[] nextIntArray(int n) {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}

		long[] nextLongArray(int n) {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLong();
			}
			return arr;
		}
		public void close(){
			try{ reader.close(); } catch(IOException e){e.printStackTrace();}
		}
	}
	static class FastWriter{
		BufferedWriter writer;
		public FastWriter(OutputStream stream){
			writer = new BufferedWriter(new OutputStreamWriter(stream));
		}
		public void print(int i) {
			print(Integer.toString(i));
		}
		public void println(int i) {
			print(Integer.toString(i));
			print('\n');
		}
		public void print(long i) {
			print(Long.toString(i));
		}
		public void println(long i) {
			print(Long.toString(i));
			print('\n');
		}
		public void print(double i) {
			print(Double.toString(i));
		}
		public void print(boolean i) {
			print(Boolean.toString(i));
		}
		public void print(Object o){
			print(o.toString());
		}
		public void println(Object o){
			print(o.toString());
			print('\n');
		}
		public void print(char i) {
			try{writer.write(i);} catch(IOException e){e.printStackTrace();}
		}
		public void print(String s){
			try{writer.write(s);} catch(IOException e){e.printStackTrace();}
		}
		public void println(String s){
			try{writer.write(s);writer.write('\n');} catch(IOException e){e.printStackTrace();}
		}
		public void println(){
			try{writer.write('\n');} catch(IOException e){e.printStackTrace();}
		}
		public void print(int arr[])
		{
			for (int i = 0; i < arr.length; i++) {
				print(arr[i]);
				print(' ');
			}
		}
		public void close(){
			try{writer.close();} catch(IOException e){e.printStackTrace();}
		}
	}

	/************************ TEMPLATE ENDS HERE ************************/
}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.security.KeyStore.Entry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.StringTokenizer;

public class MainTwo {
    static FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
    static PrintWriter out = new PrintWriter(System.out);
    static boolean file = false;
    static final int maxn = (int)4e6 + 111;
    static int inf = (int)1e9;
    static Integer n,m,cnt;
    static int a[] = new int [maxn];

    private static void solve() throws Exception {
        n = in.nextInt();
        m = 1000000;
        for (int i=1; i<=m; i++) {
            a[i] = (i*(i-1))/2;
        }
        //out.println(Arrays.toString(a));

        for (int i=1; i<=m; i++) {
            if (a[i]==816761542) out.println("aaa");
            int t = n-a[i];
            if (binPoisk(t)) {
                //out.println(t);
                out.println("YES");
                return;
            }
        }

        out.println("NO");

    }

    private static boolean binPoisk(int num) {
        int left = 1;
        int right = m;
        while (left<=right) {
            int mid = (left+right)/2;
            if (a[mid]==num) return true;
            if (a[mid]<num) {
                left = mid+1;
            } else {
                right = mid-1;
            }
        }
        return false;
    }

    public static void main (String [] args) throws Exception {

        if (file) {
            in = new FastReader(new BufferedReader(new FileReader("input.txt")));
            out = new PrintWriter ("output.txt");
        }

        solve();
        out.close();
    }

}

class Pair implements Comparable<Pair> {
    int x,y;

    public Pair(int x, int y) {
        this.x = x;
        this.y = y;
    }
    @Override
    public boolean equals(Object obj) {
        Pair p = (Pair)obj;
        if (p.x == x && p.y==y) return true;
        return false;
    }
    @Override
    public int hashCode() {
        // TODO Auto-generated method stub
        return x;
    }
    @Override
    public int compareTo(Pair p) {
        if (x<p.x)return 1;
        else if (x==p.x) return 0;
        else return -1;
    }

}

class FastReader {
    BufferedReader bf;
    StringTokenizer tk = null;

    public FastReader(BufferedReader bf) {
        this.bf = bf;
    }

    public String nextToken () throws Exception {
        if (tk==null || !tk.hasMoreTokens()) {
            tk = new StringTokenizer(bf.readLine());
        }
        return tk.nextToken();
    }

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

/**
 *
 * @author 11x256
 */
public class Test {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int n;
        n = sc.nextInt();
        int x = (int) Math.sqrt(n*2);
        for (int i = x; i * i < n * 2; i++) {
            for (int k = 1; k * k < n; k++) {
                if ((i * i + i + k * k + k) / 2 == n) {
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");

    }
}

import java.util.Scanner;

/**
 *
 * @author Ahmed
 */
public class FunkyNumbers {

    public static boolean isTriangularNumber(long num) {
        long calc_num = 8 * num + 1;
        long t = (long) Math.sqrt(calc_num);
        return t * t == calc_num;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String res = "NO";
        if (isTriangularNumber(n)) {
            System.out.println(res);
            return;
        }
        int m = (int) Math.sqrt(n * 2);
        for (int i = m; i > 0; i--) {
            if (isTriangularNumber(n - (i * (i + 1) / 2))) {
                res = "YES";
                break;
            }
        }
        //System.out.println(isTriangularNumber(14));
        System.out.println(res);
    }
}

import java.math.BigInteger;
import java.util.*;
public class hhahah {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n= sc.nextInt(); boolean f =false ;
		int ans[]= new int[44722];
		//int j = 0 ;
			for(int i=1,j=0;i*i<=n;i++)

			{
				ans[j]=i*(i+1)/2 ;
				j++;
				}
for(int i=1;i<=44722;i++){

			{
				int x = i*(i+1)/2 ;
				if(Arrays.asList(ans).contains(n-x))
				f=true ;
				break ;
				}

			}
			//if(n==1)f=false ;
		System.out.println(f?"Yes":"No");

	}

	public static boolean ispalin(String x){
		if(x.length()==0 || x.length()==1)
			return true ;
		if(x.charAt(0)!=x.charAt(x.length()-1))
			return false ;
		return ispalin(x.substring(1, x.length()-1));

	}

}

import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class Tests{
	static Scanner in = new Scanner (System.in);
	static PrintWriter out = new PrintWriter (System.out);
	static int arr [] = new int [60000];
	static Set <Integer> list = new HashSet <Integer>();

	public static void main (String []args) {

		int n = in.nextInt();

		for(int i = 1 ; i<arr.length ; i++){
			arr[i]= (i*(i+1))/2;
			list.add(arr[i]);

		}
		for(int i = 0 ; i<list.size() ; i++){
			if(list.contains(n-arr[i])){
				out.println("YES");
				out.flush();
				System.exit(0);
			}
		}
		out.println("NO");

		out.flush();
		out.close();

	}

}

import java.util.*;
public class Main
{
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);
        long number = input.nextLong();
        number *= 2;

        for(int i = 1;i < number ;++i)
        {
            long c = -number + i * i + i;
            double root = Math.sqrt(1 - 4 * c);
            if(root - (int)root == 0)
            {
                double fraction = (root - 1) / 2;
                if( root > -1 && (root - 1) % 2 == 0 && fraction < number && fraction != 0)
                {
                    System.out.println("YES");
                    System.exit(0);
                }
            }
        }
        System.out.println("NO");

    }
}

import java.util.Scanner;
public class Main {
    public static void main (String[]args) {
        Scanner in = new Scanner(System.in);
        int x = in.nextInt();
        int n[] = new int[44721];

        if ( x == 1) {
            System.out.println("NO");
        } else {
            for (int i = 0 ; i < 44721; i++) {
                n[i] = i*(i+1);
            }
            /*for (int i = 0 ; i < 100; i++) {
                System.out.println(n[i]);
            }*/
            int q = -1;
            for (int i = 0; i < 44721; i++) {
                q = BinarySearch (n, x*2 - n[i]);
                if (q != -1) {
                    System.out.println("YES");
                    break;
                }
            }
            if (q == -1) {
                System.out.println("NO");
            }
            //System.out.println( q == -1 ? "NO" : "YES");
        }
    }

    public static int BinarySearch (int[] a, int key) {
        //Note: The input array must be sorted.
        int lo = 0;
        int hi = a.length;
        int mid;
        while (lo < hi) {
            mid = (lo+hi)/2;
            if (key < a[mid]) hi = mid;
            else if (key > a[mid]) lo = mid+1;
            else return mid;
        }
        return -1;
    }//binary search method end
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;

public class A121 {
        public static void main(String[] args) {
                InputStream inputStream = System.in;
                OutputStream outputStream = System.out;
                InputReader in = new InputReader(inputStream);
                PrintWriter out = new PrintWriter(outputStream);
                CodeA121 solver = new CodeA121();
                solver.solve(1, in, out);
                out.close();
        }
}

class CodeA121
{
	public void solve(int testNumber, InputReader in, PrintWriter out)
	{
		int n=in.nextInt();
		int arr[]=new int[20000];
		for(int i=0;i<arr.length;i++)
		{
			arr[i]=((i+1)*(i+2))/2;
		}
		//out.println(arr[arr.length-1]);
		int ind1=arr.length-1;
		int ind2=0;
		int sum=0;
		int f=0;
		do
		{
			sum=arr[ind1]+arr[ind2];
			//out.println(arr[ind1]+" "+arr[ind2]);
			if(sum>n)
			{
				ind1--;
			}
			else if(sum<n)
			{
				ind2++;
			}
			else
			{
				f=1;
			}
		}while((ind1>=ind2)&&(sum!=n));
		if(f==1)
		{
			out.println("YES");
		}
		else
		{
			out.println("NO");
		}
	}

}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }
	public void inputShuffleArrayInt(int arr[])
	{
		int l=arr.length;
		for(int i=0;i<l;i++)
		{
			if(i%2==0)
			{
				arr[i/2]=nextInt();
			}
			else
			{
				arr[l-((i+1)/2)]=nextInt();
			}
		}
	}

    }