aboutsummaryrefslogtreecommitdiff
path: root/codeforces/FunkyNumbers/main.cpp
blob: 9c5234d90dcbecaf074e9732871b0152811f77a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  n = n * 2;
  set<long long> st;
  for (int i = 1; i * i <= n; i++) {
    st.insert(i * (i + 1));
  }
  bool ok = false;
  for (auto x : st) {
    cerr << x << endl;
    if(st.count(n - x)) {
      ok = true;
      break;
    }
  }
  cout << (ok ? "YES" : "NO") << endl;
}