Problem:
Score: 300 points

Problem Statement

AtCoder Mart sells 1000000 of each of the six items below:

Riceballs, priced at 100 yen (the currency of Japan) each

Sandwiches, priced at 101 yen each

Cookies, priced at 102 yen each

Cakes, priced at 103 yen each

Candies, priced at 104 yen each

Computers, priced at 105 yen each

Takahashi wants to buy some of them that cost exactly X yen in total.
Determine whether this is possible.

(Ignore consumption tax.)

Constraints

1 \leq X \leq 100000

X is an integer.

Input

Input is given from Standard Input in the following format:

X

Output

If it is possible to buy some set of items that cost exactly X yen in total, print 1; otherwise, print 0.

Sample Input 1

615

Sample Output 1

1

For example, we can buy one of each kind of item, which will cost 100+101+102+103+104+105=615 yen in total.

Sample Input 2

217

Sample Output 2

0

No set of items costs 217 yen in total.

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

// C - 100 to 105
// https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_c
#include <bits/stdc++.h>
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, h, x, w, ans = 0, count1 = 0, count2 = 0, count3 = 0, count4 = 0, count5 = 0, count6 = 0;
  string s, t;
  cin >> x;
  a = x / 100;
  // cout << "a: " << a << endl;
  // cout << "x-100*a: " << x - 100 * a << endl;
  rep(i, 0, 6)
  {
    rep(j, 0, 6)
    {
      rep(k, 0, 6)
      {
        rep(l, 0, 6)
        {
          rep(m, 0, 6)
          {
            rep(n, 0, 6)
            {
              rep(c, 0, 10)
              {
                b = i * c + j * c + k * c + l * c + m * c + n * c;
                if (b == (x - 100 * a) && count1 <= a * a * a * a * a * a && count2 <= a * a * a * a * a && count3 <= a * a * a * a && count4 <= a * a * a && count5 <= a * a && count6 <= a)
                {
                  cout << 1 << endl;
                  // cout << "base: " << i << j << k << l << m << n << endl;
                  return 0;
                }
              }
              count1++;
              // cout << "count: " << count1 << " " << count2 << " " << count3 << " " << count4 << " " << count5 << " " << count6 << endl;
            }
            count2++;
          }
          count3++;
        }
        count4++;
      }
      count5++;
    }
    count6++;
  }
  cout << 0 << endl;
}