stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <vector>

#include <queue>

#include <cmath>

#include <cstdio>

#include <cstring>

#include <iostream>



using namespace std;

const int N = 200000;



int n;

int ans[N];

vector <int> a[N];

priority_queue< pair<int,int> > q;



int main(void)

{

	scanf("%d", &n);

	for (int i=1;i<n;++i)

	{

		int x, y; scanf("%d %d", &x, &y);

		a[x].push_back(y);

		a[y].push_back(x);

	}

	memset(ans,-1,sizeof ans);

	int m; scanf("%d", &m);

	for (int i=1;i<=m;++i)

	{

		int x, v; scanf("%d %d", &x, &v);

		ans[x] = v; q.push(make_pair(-v,x));

	}

	while (q.size())

	{

		int x = q.top().second;

		int v = -q.top().first;

		q.pop();

		for (int i=0;i<a[x].size();++i)

		{

			int y = a[x][i];

			if (ans[y] >= 0 and abs(ans[x]-ans[y]) ^ 1) {

				puts("No");

				return 0;

			}

			else if (ans[y] < 0) {

				ans[y] = v + 1;

				q.push(make_pair(-ans[y],y));

			}

		}

	}

	puts("Yes"); 

	for (int i=1;i<=n;++i)

		printf("%d\n", ans[i]);

	return 0;

} 

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

  using namespace std;



#define Abigail inline void

typedef long long LL;



const int N=100000;



int n,a[N+9],vis[N+9];

struct side{

  int y,next;

}e[N*2+9];

int lin[N+9],cs;



void Ins(int x,int y){e[++cs].y=y;e[cs].next=lin[x];lin[x]=cs;}

void Ins2(int x,int y){Ins(x,y);Ins(y,x);}



struct state{

  int x,v;

  state(int X=0,int V=0){x=X;v=V;}

  bool operator > (const state &p)const{return v>p.v;}

};

priority_queue<state,vector<state>,greater<state> >q;



bool Bfs_ans(){

  for (int i=1;i<=n;++i)

    if (vis[i]) q.push(state(i,a[i]));

  for (;!q.empty();){

  	int t=q.top().x;q.pop();

  	for (int i=lin[t];i;i=e[i].next)

  	  if (vis[e[i].y]){

  	  	if (abs(a[t]-a[e[i].y])^1) return 0;

  	  }else{

  	    vis[e[i].y]=1;

	    q.push(state(e[i].y,a[e[i].y]=a[t]+1));

  	  }

  }

  return 1;

}



Abigail into(){

  scanf("%d",&n);

  for (int i=1;i<n;++i){

  	int x,y;

  	scanf("%d%d",&x,&y);

  	Ins2(x,y);

  }

  int m;

  scanf("%d",&m);

  for (int i=1;i<=m;++i){

  	int x,v;

  	scanf("%d%d",&x,&v);

  	a[x]=v;vis[x]=1;

  }

}



Abigail outo(){

  if (Bfs_ans()){

  	puts("Yes");

  	for (int i=1;i<=n;++i)

  	  printf("%d\n",a[i]);

  }else puts("No");

}



int main(){

  into();

  outo();

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define int long long

vector<pair<int,int> > edge[100005];

int dis[100005];

bool check[100005];

priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > pq;

signed main(){

	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

	int n;

	cin>>n;

	for(int i=1;i<=n;i++){

		dis[i]=1e18;

	}

	int s=n+1;

	check[s]=1;

	dis[s]=0;

	for(int i=1;i<n;i++){

		int u,v;

		cin>>u>>v;

		edge[u].push_back(make_pair(1,v));

		edge[v].push_back(make_pair(1,u));

	}

	int k;

	cin>>k;

	while(k--){

		int u,p;

		cin>>u>>p;

		check[u]=1;

		dis[u]=p;

		pq.push(make_pair(dis[u],u));

	}

	while(!pq.empty()){

		pair<int,int> t=pq.top();

		pq.pop();

		int u=t.second,val=t.first;

		if(dis[u]<val) continue;

		for(int i=0;i<edge[u].size();i++){

			pair<int,int> bang=edge[u][i];

			int cost=bang.first,v=bang.second;

			if(dis[u]+cost<dis[v]){

				if(check[v]){

					cout<<"No";

					return 0;

				}

				dis[v]=dis[u]+cost;

				pq.push(make_pair(dis[v],v));

			}

		}

	}

	for(int i=1;i<=n;i++){

		for(int j=0;j<edge[i].size();j++){

			if(dis[i]-dis[edge[i][j].second]!=1&&dis[edge[i][j].second]-dis[i]!=1){

				cout<<"No";

				return 0;

			}

		}

	}

	cout<<"Yes\n";

	for(int i=1;i<=n;i++){

		cout<<dis[i]<<"\n";

	}

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstring>

#include <queue>

using namespace std;

int head[100005],arrive[200005],nxt[200005],tot;

void add_edge(int from,int to){

	arrive[++tot]=to;

	nxt[tot]=head[from];

	head[from]=tot;

}

struct Node{

	int id;

	int value;

	friend bool operator >(Node p,Node q){

		return p.value>q.value;

	}

};

priority_queue<Node,vector<Node>,greater<Node> > q;

int value[100005];

int ab(int a){

	return a<0?-a:a;

}

int main(){

	int n;

	scanf("%d",&n);

	int u,v;

	for(int i=1;i<n;i++){

		scanf("%d%d",&u,&v);

		add_edge(u,v);

		add_edge(v,u);

	}

	memset(value,-1,sizeof value);

	int k;

	scanf("%d",&k);

	for(int i=1;i<=k;i++){

		scanf("%d%d",&u,&v);

		value[u]=v;

		q.push((Node){u,v});

	}

	while(!q.empty()){

		u=q.top().id;

		v=q.top().value;

		q.pop();

		for(int i=head[u];i;i=nxt[i]){

			if(value[arrive[i]]!=-1){

				continue;

			}

			value[arrive[i]]=v+1;

			q.push((Node){arrive[i],v+1});

		}

	}

	for(int i=1;i<=n;i++){

		for(int j=head[i];j;j=nxt[j]){

			if(ab(value[i]-value[arrive[j]])!=1){

				puts("No");

				return 0;

			}

		}

	}

	puts("Yes");

	for(int i=1;i<=n;i++){

		printf("%d\n",value[i]);

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define N 100005



using namespace std;

int INF = 1e9;

typedef pair<int,int> ii;

vector<int> AdjList[N];

priority_queue<ii,vector<ii>,greater<ii>> pq;



signed main()

{

    int n;

    cin>>n;

    int ans[n+1];



    for(int i=1;i<=n;i++)

        ans[i] = INF;



    for(int i=1;i<n;i++)

    {

        int u,v;

        cin>>u>>v;

        AdjList[u].push_back(v);

        AdjList[v].push_back(u);

    }



    int m;

    cin>>m;



    for(int i=1;i<=m;i++)

    {

        int u,c;

        cin>>u>>c;

        ans[u] = c;

        pq.push(ii(c,u));

    }



    while(!pq.empty())

    {

        int u = pq.top().second;

        int c = pq.top().first;

        pq.pop();



        for(int v:AdjList[u])

        {

            if(ans[v]==INF)

            {

                ans[v] = ans[u] + 1;

                pq.push(ii(ans[v],v));

            }

            else

            {

                if(abs(ans[u]-ans[v])!=1)

                {

                    cout<<"No";

                    return 0;

                }

            }

        }

    }



    cout<<"Yes\n";

    for(int i=1;i<=n;i++)

        cout<<ans[i]<<'\n';





}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstring>

#include <queue>

using namespace std;

int head[100005],arrive[200005],nxt[200005],tot;

void add_edge(int from,int to){

	arrive[++tot]=to;

	nxt[tot]=head[from];

	head[from]=tot;

}

struct Node{

	int id;

	int value;

	friend bool operator >(Node p,Node q){

		return p.value>q.value;

	}

};

priority_queue<Node,vector<Node>,greater<Node> > q;

int value[100005];

int ab(int a){

	return a<0?-a:a;

}

int main(){

	int n;

	scanf("%d",&n);

	int u,v;

	for(int i=1;i<n;i++){

		scanf("%d%d",&u,&v);

		add_edge(u,v);

		add_edge(v,u);

	}

	memset(value,-1,sizeof value);

	int k;

	scanf("%d",&k);

	for(int i=1;i<=k;i++){

		scanf("%d%d",&u,&v);

		value[u]=v;

		q.push((Node){u,v});

	}

	while(!q.empty()){

		u=q.top().id;

		v=q.top().value;

		q.pop();

		for(int i=head[u];i;i=nxt[i]){

			if(value[arrive[i]]!=-1){

				continue;

			}

			value[arrive[i]]=v+1;

			q.push((Node){arrive[i],v+1});

		}

	}

	for(int i=1;i<=n;i++){

		for(int j=head[i];j;j=nxt[j]){

			if(ab(value[i]-value[arrive[j]])!=1){

				puts("No");

				return 0;

			}

		}

	}

	puts("Yes");

	for(int i=1;i<=n;i++){

		printf("%d\n",value[i]);

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<queue>

#include<vector>

#include<algorithm>

using namespace std;

int n,m,ans[100005];

vector<int>g[100005];

#define INF 0x3f3f3f3f

struct mzls

{

	int a,b;

	bool operator < (const mzls &x) const

	{

		return x.a<a;

	}

}as;

priority_queue<mzls>que;

int main()

{

	scanf("%d",&n);

	for(int i=1;i<n;i++)

	{

		int x,y;

		scanf("%d%d",&x,&y);

		g[x].push_back(y);

		g[y].push_back(x);

		ans[i]=INF;

	}

	ans[n]=INF;

	scanf("%d",&m);

	for(int i=1;i<=m;i++)

	{

		scanf("%d%d",&as.b,&as.a);

		que.push(as);

		ans[as.b]=as.a;

	}

	while(!que.empty())

	{

		as=que.top();

		que.pop();

		int u=as.b;

		for(int i=0;i<g[u].size();i++)

		{

			int v=g[u][i];

			if(ans[v]==INF)

			{

				ans[v]=ans[u]+1;

				as.b=v,as.a=ans[v];

				que.push(as);

			}

			if(!((ans[v]-ans[u])==1||(ans[v]-ans[u])==-1))

			{

				printf("No");

				return 0;

			}

		}

	}

	printf("Yes\n");

	for(int i=1;i<=n;i++)

		printf("%d\n",ans[i]);

}//


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstring>

#include <queue>

using namespace std;

int head[100005],arrive[200005],nxt[200005],tot;

void add_edge(int from,int to){

	arrive[++tot]=to;

	nxt[tot]=head[from];

	head[from]=tot;

}

struct Node{

	int id;

	int value;

	friend bool operator >(Node p,Node q){

		return p.value>q.value;

	}

};

priority_queue<Node,vector<Node>,greater<Node> > q;

int value[100005];

int ab(int a){

	return a<0?-a:a;

}

int main(){

	int n;

	scanf("%d",&n);

	int u,v;

	for(int i=1;i<n;i++){

		scanf("%d%d",&u,&v);

		add_edge(u,v);

		add_edge(v,u);

	}

	memset(value,-1,sizeof value);

	int k;

	scanf("%d",&k);

	for(int i=1;i<=k;i++){

		scanf("%d%d",&u,&v);

		value[u]=v;

		q.push((Node){u,v});

	}

	while(!q.empty()){

		u=q.top().id;

		v=q.top().value;

		q.pop();

		for(int i=head[u];i;i=nxt[i]){

			if(value[arrive[i]]!=-1){

				continue;

			}

			value[arrive[i]]=v+1;

			q.push((Node){arrive[i],v+1});

		}

	}

	for(int i=1;i<=n;i++){

		for(int j=head[i];j;j=nxt[j]){

			if(ab(value[i]-value[arrive[j]])!=1){

				puts("No");

				return 0;

			}

		}

	}

	puts("Yes");

	for(int i=1;i<=n;i++){

		printf("%d\n",value[i]);

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



typedef long long ll;

typedef pair<int, int> ii; 



const int maxn = 1e5 + 10;

vector<int> adj[maxn]; 

int p[maxn], n, k, d[maxn];



int main(int argc, char const *argv[]) {

#ifdef LOCAL_TESTING

	freopen("in", "r", stdin);

#endif

	scanf("%d", &n);

	for(int i = 1; i < n; i++) {

		int u, v;

		scanf("%d %d", &u, &v);

		adj[u].push_back(v);

		adj[v].push_back(u);

	} scanf("%d", &k);

	memset(p, -1, sizeof p);

	

	priority_queue<ii, vector<ii>, greater<ii> > q;

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

		int u; scanf("%d", &u);

		scanf("%d", &p[u]);

		q.push({p[u], u});

	} 

	while(!q.empty()) {

		ii x = q.top(); q.pop(); 

		int val = x.first, u = x.second; 

		for(int v : adj[u]) {

			if(p[v] == -1) {

				p[v] = val + 1;

				q.push({p[v], v});

			}

			else if(abs(p[v] - p[u]) != 1) {

				puts("No"); return 0;

			}

		}

	}

	puts("Yes");

	for(int i = 1; i <= n; i++) {

		printf("%d\n", p[i]);

	}



}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



typedef long long ll;

typedef pair<int, int> ii; 



const int maxn = 1e5 + 10;

vector<int> adj[maxn]; 

int p[maxn], n, k;



int main(int argc, char const *argv[]) {

#ifdef LOCAL_TESTING

	freopen("in", "r", stdin);

#endif

	scanf("%d", &n); p[n] = -1;

	for(int i = 1; i < n; ++i) {

		int u, v; p[i] = -1;

		scanf("%d %d", &u, &v);

		adj[u].push_back(v);

		adj[v].push_back(u);

	} scanf("%d", &k);	

	priority_queue<ii, vector<ii>, greater<ii> > q;

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

		int u; scanf("%d", &u);

		scanf("%d", &p[u]);

		q.push({p[u], u});

	} 

	while(!q.empty()) {

		ii x = q.top(); q.pop(); 

		int val = x.first, u = x.second; 

		for(int v : adj[u]) {

			if(p[v] == -1) {

				p[v] = val + 1;

				q.push({p[v], v});

			}

			else if(abs(p[v] - p[u]) != 1) {

				puts("No"); return 0;

			}

		}

	}

	puts("Yes");

	for(int i = 1; i <= n; ++i) {

		printf("%d\n", p[i]);

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<fstream>

#include<sstream>

#include<algorithm>

#include<cstdio>

#include<cassert>

#include<cmath>

#include<cstdlib>

#include<cstring>

#include<string>

#include<deque>

#include<queue>

#include<vector>

#include<list>

#include<map>

#include<set>

#include<bitset>

#include<stack>

#include<iomanip>

#include<utility>

#include<functional>

using namespace std;

int n,k;

int a[100005];

vector<int> edge[100005];



int main()

{

	cin>>n;

	for(int i=0;i<n-1;i++)

	{

		int x,y;

		cin>>x>>y;

		x--;

		y--;

		edge[x].push_back(y);

		edge[y].push_back(x);

	}

	memset(a,-1,sizeof(a));

	priority_queue<pair<int,int> > q;

	cin>>k;

	for(int i=0;i<k;i++)

	{

		int x,v;

		cin>>x>>v;

		x--;

		a[x]=v;

		q.push(make_pair(-v,x));

	}

	while(!q.empty())

	{

		int x,v;

		x=q.top().second;

		q.pop();

		for(int i=0;i<edge[x].size();i++)

		{

			int y=edge[x][i];

			if(a[y]==-1)

			{

				a[y]=a[x]+1;

				q.push(make_pair(-a[y],y));

			}

		}

	}

	for(int x=0;x<n;x++)

		for(int i=0;i<edge[x].size();i++)

		{

			int y=edge[x][i];

			if(a[x]-a[y]!=1&&a[x]-a[y]!=-1)

			{

				cout<<"No";

				return 0;

			}

		}

	cout<<"Yes"<<endl;

	for(int i=0;i<n;i++)

		cout<<a[i]<<endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

#define pii pair<int,int>

const int N = 1e5+20;

struct edge { int ver,next; } e[N*2];

int n,k,t,Head[N],val[N];

inline void insert(int x,int y) { e[++t] = (edge){y,Head[x]} , Head[x] = t; }

inline void input(void)

{

    scanf("%d",&n);

    for (int i=1;i<n;i++)

    {

        int x,y;

        scanf("%d%d",&x,&y);

        insert( y , x );

        insert( x , y );

    }

    scanf("%d",&k);

    for (int i=1;i<=k;i++)

    {

        int x,y;

        scanf("%d%d",&x,&y);

        val[x] = y;

    }

}

inline void solve(void)

{

    priority_queue < pii , vector< pii > , greater< pii > > Heap;

    for (int i=1;i<=n;i++)

        if ( val[i] != -1 )

            Heap.push( make_pair( val[i] , i ) );

    if ( Heap.empty() )

        Heap.push( make_pair( 1 , 1 ) ) , val[1] = 1;

    while ( !Heap.empty() )

    {

        int x = Heap.top().second; Heap.pop();

        for (int i=Head[x];i;i=e[i].next)

        {

            int y = e[i].ver;

            if ( val[y] == -1 )

            {

                val[y] = val[x] + 1;

                Heap.push( make_pair( val[y] , y ) );

            }

        }

    }

}

inline bool check(void)

{

    for (int i=1;i<=n;i++)

        for (int j=Head[i];j;j=e[j].next)

            if ( abs( val[e[j].ver] - val[i] ) != 1 )

                return false;

    return true;

}

int main(void)

{

    memset( val , 0xff , sizeof val );

    input();

    solve();

    if ( check() )

    {

        puts("Yes");

        for (int i=1;i<=n;i++)

            printf("%d\n",val[i]);

    }

    else puts("No");

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#pragma GCC optimize("O3")

#include <iostream>

#include <iomanip>

#include <cstdio>

#include <string>

#include <cstring>

#include <deque>

#include <list>

#include <queue>

#include <stack>

#include <vector>

#include <utility>

#include <algorithm>

#include <map>

#include <set>

#include <complex>

#include <cmath>

#include <limits>

#include <cfloat>

#include <climits>

#include <ctime>

#include <cassert>

#include <numeric>

#include <fstream>

#include <functional>

#include <bitset>

using namespace std;



using ll = long long;

using P = pair<int, int>;

using T = tuple<int, int, int>;



template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}

template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}



constexpr int MOD = 1e9 + 7;

constexpr int inf = 1e9;

constexpr long long INF = 1e18;

constexpr double pi = acos(-1);

constexpr double EPS = 1e-10;



int dx[] = {1, 0, -1, 0};

int dy[] = {0, 1, 0, -1};



int main(){

    cin.tie(0);

    ios::sync_with_stdio(false);



    int x; cin>>x;



    bool valid = false;

    for(int i=1; i<=1000000; i++){

        if(100 * i <= x && x <= 105 * i){

            valid = true;

        }

    }



    cout << valid << endl;



    return 0;

}

// Optimized solution to the same problem (faster):
#pragma GCC optimize("O3")

#include <iostream>

#include <iomanip>

#include <cstdio>

#include <string>

#include <cstring>

#include <deque>

#include <list>

#include <queue>

#include <stack>

#include <vector>

#include <utility>

#include <algorithm>

#include <map>

#include <set>

#include <complex>

#include <cmath>

#include <limits>

#include <cfloat>

#include <climits>

#include <ctime>

#include <cassert>

#include <numeric>

#include <fstream>

#include <functional>

#include <bitset>

using namespace std;



using ll = long long;

using P = pair<int, int>;

using T = tuple<int, int, int>;



template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}

template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}



constexpr int MOD = 1e9 + 7;

constexpr int inf = 1e9;

constexpr long long INF = 1e18;

constexpr double pi = acos(-1);

constexpr double EPS = 1e-10;



int dx[] = {1, 0, -1, 0};

int dy[] = {0, 1, 0, -1};



int main(){

    cin.tie(0);

    ios::sync_with_stdio(false);



    int x; cin>>x;



    int c = x / 100;



    cout << (100 * c <= x && x <= 105 * c) << endl;



    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <map>

#include <algorithm>

#include <string>

#include <vector> 

#include <numeric>

#include <cmath>

#include <queue>

#include <iomanip>

#include <functional>



#define CHMAX(a,b) a = std::max(a,b)

#define CHMIN(a,b) a = std::min(a,b)

#define MAXMIN(a,b,c) std::max(a,min(b,c))

#define CHABS(a) a = std::abs(a) 

#define COUT(a) std::cout << a << std::endl

#define CERR(a) std::cerr << a << std::endl

#define FOR(n) for(lli i = 0; i < n; i++)



using namespace std;

using lli = long long int;

using pll = pair<lli, lli>;

using tlll = tuple<lli, lli, lli>;

using vll = vector<lli>;



lli mod197 = 1000000007LL;

lli INF = 10000000000000;



// ax + by = gcd(a,b) 最大公約数

template< typename T >

T extgcd(T a, T b, T& x, T& y) {

	T d = a;

	if (b != 0) {

		d = extgcd(b, a % b, y, x);

		y -= (a / b) * x;

	}

	else {

		x = 1;

		y = 0;

	}

	return d;

}



int A[100200] = {};



int main(void) {



	int X;

	cin >> X;



	A[0] = 1;



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

		for (int j = 0; j < 100000; j++) {

			CHMAX(A[j + (100 + i)],A[j]);

		}

	}



	if (A[X] == 0) {

		COUT(0);

	}

	else {

		COUT(1);

	}



	return 0;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <map>

#include <algorithm>

#include <string>

#include <vector> 

#include <numeric>

#include <cmath>

#include <queue>

#include <iomanip>

#include <functional>



#define CHMAX(a,b) a = std::max(a,b)

#define CHMIN(a,b) a = std::min(a,b)

#define MAXMIN(a,b,c) std::max(a,min(b,c))

#define CHABS(a) a = std::abs(a) 

#define COUT(a) std::cout << a << std::endl

#define CERR(a) std::cerr << a << std::endl

#define FOR(n) for(lli i = 0; i < n; i++)



using namespace std;

using lli = long long int;

using pll = pair<lli, lli>;

using tlll = tuple<lli, lli, lli>;

using vll = vector<lli>;



lli mod197 = 1000000007LL;

lli INF = 10000000000000;



// ax + by = gcd(a,b) 最大公約数

template< typename T >

T extgcd(T a, T b, T& x, T& y) {

	T d = a;

	if (b != 0) {

		d = extgcd(b, a % b, y, x);

		y -= (a / b) * x;

	}

	else {

		x = 1;

		y = 0;

	}

	return d;

}



int A[100200] = {};



int main(void) {



	int X;

	cin >> X;



	if (X >= 2000) {

		COUT(1);

	}

	else {

		if (X % 100 <= (X / 100) * 5) {

			COUT(1);

		}

		else {

			COUT(0);

		}

	}



	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <iomanip>

#include <string>

#include <vector>

#include <algorithm>

#include <map>

#include <cmath>

#include <queue>

#include <set>

#include <cassert>

#include <random>



#define rep(i, n) for (int i = 0; i < (n); i++)



using namespace std;

typedef long long int ll;

const ll INF = 1000000000;

const double PI = acos(-1);

const int mod = 1000000007;



int main()

{

    int x;

    cin >> x;



    for (int n = 1; n <= 1000; n++) {

        for (int i = 100 * n; i <= 105 * n; i++) {

            if (i == x) {

                cout << 1 << endl;

                return 0;

            }

        }

    }

    cout << 0 << endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <iomanip>

#include <string>

#include <vector>

#include <algorithm>

#include <map>

#include <cmath>

#include <queue>

#include <set>

#include <cassert>

#include <random>



#define rep(i, n) for (int i = 0; i < (n); i++)



using namespace std;

typedef long long int ll;

const ll INF = 1000000000;

const double PI = acos(-1);

const int mod = 1000000007;



int dp[100001] = {0};



int main()

{

    int x;

    cin >> x;



    dp[0] = 1;

    for (int i = 100; i <= 105; i++) {

        dp[i] = 1;

    }

    for (int i = 200; i <= x; i++) {

        if (dp[i - 100] || dp[i - 101] || dp[i - 102] || dp[i - 103] || dp[i - 104] || dp[i - 105]) {

            dp[i] = 1;

        }

    }

    cout << dp[x] << endl;

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <algorithm>

#include <iostream>

#include <vector>



#include <string.h>



using namespace std;



typedef long long ll;



template<class T>

inline bool chmax(T &a, T b) {

    if(a < b) {

        a = b;

        return true;

    }

    return false;

}



template<class T>

inline bool chmin(T &a, T b) {

    if(a > b) {

        a = b;

        return true;

    }

    return false;

}



const int MAX_X = 1000000; // 10 ** 6



int memo[MAX_X + 1];



bool solve(const int x) {

    if (memo[x] == 1) {

        return true;

    } else if (memo[x] == 0) {

        return false;

    }



    if (x < 100) {

        return false;

    }



    if (solve(x - 100) || solve(x - 101) || solve(x - 102) || solve(x - 103) || solve(x - 104) || solve(x - 105)) {

        memo[x] = 1;

        return true;

    } else {

        memo[x] = 0;

        return false;

    }

}



int main(void) {

    int X;

    cin >> X;



    memset(memo, -1, sizeof(memo));



    memo[100] = 1;

    memo[101] = 1;

    memo[102] = 1;

    memo[103] = 1;

    memo[104] = 1;

    memo[105] = 1;



    if (solve(X)) {

        cout << "1" << endl;

    } else {

        cout << "0" << endl;

    }

    

    return 0;

}


// Optimized solution to the same problem (faster):
#include <algorithm>

#include <iostream>

#include <vector>



using namespace std;



typedef long long ll;



template<class T>

inline bool chmax(T &a, T b) {

    if(a < b) {

        a = b;

        return true;

    }

    return false;

}



template<class T>

inline bool chmin(T &a, T b) {

    if(a > b) {

        a = b;

        return true;

    }

    return false;

}



vector<bool> dp;



int main(void) {

    int X;

    cin >> X;



    dp.resize(X + 110, false);

    dp[0] = true;



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

        if (dp[i]) {

            dp[i + 100] = true;

            dp[i + 101] = true;

            dp[i + 102] = true;

            dp[i + 103] = true;

            dp[i + 104] = true;

            dp[i + 105] = true;

        }

    }



    if (dp[X]) {

        cout << "1" << endl;

    } else {

        cout << "0" << endl;

    }



    return 0;

}


// Fastest known solution for this problem: