akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

class Program
{
    static long F(long n, long N)
    {
        if (n > N)
            return 0;
        else
        {
            string s = n.ToString();
            uint r = 0;
            for(int i = 0; i < s.Length; i++)
            {
                if (s[i] == '7')
                    r |= 1;
                if (s[i] == '5')
                    r |= 2;
                if (s[i] == '3')
                    r |= 4;
            }
            return F(10 * n + 7, N) + F(10 * n + 5, N) + F(10 * n + 3, N) + (r == 7 ? 1 : 0);
        }
    }

    public static void Main()
    {
        long N = long.Parse(Console.ReadLine());
        Console.WriteLine(F(0,N));
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int t[20][20];
int dp[1<<16];

void f(int n){
  rep(i,n){
    rep(j,n+1){
      cin>>t[i][j];
    }
  }
  rep(i,1<<16){
    dp[i]=inf;
  }
  dp[0]=0;
  rep(i,1<<n){
    rep(j,n){
      if(i&(1<<j)) continue;
      int v=t[j][0];
      rep(k,n){
        if(i&(1<<k)) v=min(v,t[j][k+1]);
      }
      dp[i+(1<<j)]=min(dp[i+(1<<j)],dp[i]+v);
    }
  }

  cout<<dp[(1<<n)-1]<<endl;
}
  


int main(){
  int n;
  while(true){
    cin>>n;
    if(n==0) break;
    f(n);
  }
}



Measured memory_bytes: 3332
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
  char c;
  cin >> c;
  if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define cint int t;cin>>t;while(t--)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define vint vector<int>
#define all(v) (v).begin(), (v).end()
#define pii pair<int,int>
#define pb push_back
const int N=1e5+5;



int32_t main() {
    faster;

    int k,n;
    cin>>k>>n;

    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];

    sort(a,a+n);

    int ans=a[n-1]-a[0];

    for(int i=1;i<n;i++){
        ans=min(ans,abs(k-a[i])+abs(a[i-1]));
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <stdio.h>

#define ARRAY_INIT 0
#define DIV_INIT 0
#define LOOP_INIT 0
#define G_MAX 12

int main( void )
{
	unsigned long ulW_Dtc_cnt;
	int *aulW_Dtestcase;
	unsigned long ulW_Cloop_cnt;
	unsigned long ulW_Cloop_sub_cnt;
	unsigned long ulW_Csort_cnt = DIV_INIT;
	unsigned long ulW_Dm;
	int aulW_DG[ G_MAX ];
	unsigned long ulW_Dv;
	int ulW_Dk;

	scanf( "%d", &ulW_Dtc_cnt );
	aulW_Dtestcase = ( int * ) malloc ( sizeof ( int ) * ulW_Dtc_cnt );
	for( ulW_Cloop_cnt = LOOP_INIT; ulW_Cloop_cnt < ulW_Dtc_cnt; ulW_Cloop_cnt++ ){
		scanf( "%d", &aulW_Dtestcase[ ulW_Cloop_cnt ] );
	}

	ulW_Dm = 1;
	aulW_DG[ 0 ] = 1;
	while( 3 * aulW_DG[ ulW_Dm - 1 ] + 1 < ulW_Dtc_cnt ){
		aulW_DG[ ulW_Dm ] = 3 * aulW_DG[ ulW_Dm - 1 ] + 1;
		ulW_Dm++;
	}

	for( ulW_Cloop_cnt = LOOP_INIT; ulW_Cloop_cnt < ulW_Dm / 2; ulW_Cloop_cnt++ ){
		ulW_Dv = aulW_DG[ ulW_Cloop_cnt ];
		aulW_DG[ ulW_Cloop_cnt ] = aulW_DG[ ulW_Dm - 1 - ulW_Cloop_cnt ];
		aulW_DG[ ulW_Dm - 1 - ulW_Cloop_cnt ] = ulW_Dv;
	}

	printf( "%d\n", ulW_Dm );
	for( ulW_Cloop_cnt = LOOP_INIT; ulW_Cloop_cnt < ulW_Dm; ulW_Cloop_cnt++ ){
		if( ulW_Cloop_cnt == ulW_Dm - 1 ){
			printf( "%d\n", aulW_DG[ ulW_Cloop_cnt ] );
		}
		else{
			printf( "%d ", aulW_DG[ ulW_Cloop_cnt ] );
		}
	}

	for( ulW_Cloop_cnt = LOOP_INIT; ulW_Cloop_cnt < ulW_Dm; ulW_Cloop_cnt++){
		for( ulW_Cloop_sub_cnt = aulW_DG[ ulW_Cloop_cnt ]; ulW_Cloop_sub_cnt < ulW_Dtc_cnt; ulW_Cloop_sub_cnt++ ){
			ulW_Dv = aulW_Dtestcase[ ulW_Cloop_sub_cnt ];
			ulW_Dk = ulW_Cloop_sub_cnt - aulW_DG[ ulW_Cloop_cnt ];
			while( ( ulW_Dk >= 0 ) && ( aulW_Dtestcase[ ulW_Dk ] > ulW_Dv ) ){
				aulW_Dtestcase[ ulW_Dk + aulW_DG[ ulW_Cloop_cnt ] ] = aulW_Dtestcase[ ulW_Dk ];
				ulW_Dk -= aulW_DG[ ulW_Cloop_cnt ];
				ulW_Csort_cnt++;
			}
			aulW_Dtestcase[ ulW_Dk + aulW_DG[ ulW_Cloop_cnt ] ] = ulW_Dv;
		}
	}

	printf( "%d\n", ulW_Csort_cnt );
	for( ulW_Cloop_cnt = LOOP_INIT; ulW_Cloop_cnt < ulW_Dtc_cnt; ulW_Cloop_cnt++ ){
		printf( "%d\n", aulW_Dtestcase[ ulW_Cloop_cnt ] );
	}

	return 0;
}

Measured memory_bytes: 4508
#include<bits/stdc++.h>
using namespace std;

// template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
// template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 998244353
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;

int main(){
    int N,W; cin>>N>>W;
    vector<ll> w(N),v(N);
    rep(i,N)cin>>w[i]>>v[i];
    vector<vector<ll>> dp(N+1,vector<ll>(100100,INF));//dp[i][v] 価値vの荷物を入れたときの重さの最小値
    dp[0][0] = 0;
    rep(i,N){
        rep(j,100100){
            if(j-v[i]>=0) dp[i+1][j] = min(dp[i+1][j],dp[i][j-v[i]]+w[i]);
            dp[i+1][j] = min(dp[i+1][j],dp[i][j]);
        }
    }
    ll res = 0;
    rep(i,100100){
        if(dp[N][i] <= W) res = max(res,(ll)i);
    }
    cout<<res<<endl;
}

Measured memory_bytes: 83232
#include<bits/stdc++.h>
#define mod 1000000009
#define int signed long long int 
#define garou ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
int pow(int p,int r){
	int ans=1;
	while(r>0){
     if(r&1){
		 ans=((ans%mod)*(p%mod))%mod;
	 }
	 r=r>>1;
     p=((p%mod)*(p%mod))%mod;
	}
}
signed main() {
garou;
int x,y;
cin>>x>>y;
for(int i=0;i<=x;i++){
	int l=2*i;
	int r=(4*(x-i));
	if(l+r==y){
		cout<<"Yes";
		return 0;
	}
}
cout<<"No";
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <functional>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<double,double> dd;
typedef pair<ll,ll> pll;
typedef pair<string,int> psi;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvll;
typedef vector<vector<ii> > vvip;
typedef vector<ii> vii;
typedef map<int,int> mpi;
#define pb push_back
#define F first
#define S second
//#define MOD 1000000007
#define NA -1
#define ALL(v) v.begin(),v.end()
#define mp make_pair
#define rep(i, n) for (int (i) = 0; (i) < (n); (i) ++)
#define rep1(i, n) for (int (i) = 1; (i) <= (n); (i) ++)
#define FOR(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define db(x) {cout << #x << " = " << (x) << endl;}
#define dba(a, x, y) {cout<<#a<<" :";FOR(i123,x,y)cout<<setw(4)<<(a)[i123];cout<<endl;}
#define foreach(e, x) for (__typeof(x.begin()) e = x.begin(); e != x.end(); e++) 
#define clr(x) memset(x,0,sizeof(x));
#define sz(x) int((x).size())
#define endl '\n'
const int INF = INT_MAX;
const ll INFL = LLONG_MAX;
const ld pi = acos(-1);
#define sc(t) scanf("%d",&t)
// vector<string> split(const string &s, char delim) {
//     stringstream ss(s);
//     string item;
//     vector<string> tokens;
//     while (getline(ss, item, delim)) {
//         tokens.push_back(item);
//     }
//     return tokens;
// }

typedef pair<pll,ll> ppll;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
#define re return
#define MAX 100

 // struct compare  
 // {  
 //   bool operator()(const ii& a, const ii& b)  
 //   {  
 //       re (a.S-a.F+1 < b.S-b.F+1) || (a.S-a.F+1 == b.S-b.F+1 && a.F>b.F);
 //   }
 // };

	
int main()
{
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt","r",stdin);
	//     freopen("output.txt","w",stdout);;
	// #endif
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	//ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
	ios_base::sync_with_stdio(0); cout.precision(15); cout << fixed; cout.tie(0); cin.tie(0);
	string a,b;
	cin>>a>>b;
	if( sz(a)>sz(b))
		cout<<"GREATER"<<endl;
	else if( sz(b)>sz(a))
		cout<<"LESS"<<endl;
	else
	{
		rep(i,sz(a))
		{
			if(a[i]<b[i])
			{
				cout<<"LESS";
				re 0;
			}
			else if( a[i]>b[i])
			{
				cout<<"GREATER\n";
				re 0;
			}

		}
		cout<<"EQUAL\n";
		re 0;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main(){
    
    int N;
    cin >> N;
    vector <int> a(N);
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    
    
    sort(a.begin(), a.end());
    
    int al = 0;
    int ber = 0;
    for(int i = 0; i < N; i++){
        if(i%2 == 0){
            al = al+a[N-1-i];
        }else{
            ber = ber + a[N-1-i];
        }
    }
    
    cout << al - ber << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T&a,T b){if(a>b){a=b;return 1;}return 0;}
typedef long long ll;

int n,m,k;
string s,t;

int main() {
  cin >> n;
  int a[n]; 
  rep(i,n){
    cin >> a[i]; a[i]--;
  } 
  int ans=0;
  rep(i,n){
    if(a[i]==i && a[i+1]==i+1) swap(a[i],a[i+1]),ans++;
  }
  rep(i,n)if(a[i]==i) ans++;
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include<algorithm>
using namespace std;

int main()
{
    int a[105],counter=0,x,i,min_;
    long long int n;
    cin>>x>>n;
    for(i=0;i<x;i++)
	{
		cin>>a[i];
		if(n>0)
		{
			n-=a[i];
			counter++;
		}
		else
			break;
	}
	sort(a,a+x);
	counter+=n/a[0];
	cout<<counter<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int m,n,i,j,c=0;
  int A[101][101],b[1001];

  scanf("%d %d",&n,&m);
  for(i=1;i<=n;i++){
    for(j=1;j<=m;j++){
      scanf("%d",&A[i][j]);
    }
  }
  for(i=1;i<=m;i++){
    scanf("%d",&b[i]);
  }
  for(i=1;i<=n;i++){
    for(j=1;j<=m;j++){
      c=A[i][j]*b[j]+c;
    }
      printf("%d\n",c);
      c=0;
  }
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;

int main(){
  int A,B,C,D,E,R,L,Y,X;
  cin >> R >> L;
  if(R>L){
    X=L;
    Y=R;
  }
  else{
    X=R;
    Y=L;
  }
  while(X<=Y){
    A=X/10000;
    B=X%10000/1000;
    D=X%100/10;
    E=X%10/1;
    if(A==E && B==D){
      C++;
    }
    X++;
  }
  cout << C <<endl;
}

Measured memory_bytes: 256
// 6/2
// 2-6-3. 素数判定
// 類題
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;

bool is_prime(int n) {
    if (n == 1) return false;
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

// vector<int> divisor(int n) {
//     vector<int> res;

// }

map<ll, ll> mp;

void prime_factor(ll n) {
    for(ll i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            n /= i;
            mp[i]++;
        }
    }
    if (n != 1) mp[n]++;
}

int main() {
    ll n;
    cin >> n;

    for (ll i = 1; i <= n; i++) {
        prime_factor(i);
    }

    ll ans = 1;
    ll mod = 1000000007;

    for (auto p : mp) {
        (ans *= (p.second + 1)) %= mod;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr = ds.begin(); itr != ds.end(); ++itr)
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
#define PI 3.1415926536
typedef long long ll;
typedef pair<int, int> P;



int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	repl(i, sy, ty) {
		cout << 'U';
	}
	repl(i, sx, tx) {
		cout << 'R';
	}
	repl(i, sy, ty) {
		cout << 'D';
	}
	repl(i, sx, tx) {
		cout << 'L';
	}
	cout << 'L';
	repl(i, sy, ty + 1) {
		cout << 'U';
	}
	repl(i, sx, tx + 1) {
		cout << 'R';
	}
	cout << "DR";
	repl(i, sy, ty + 1) {
		cout << 'D';
	}
	repl(i, sx, tx + 1) {
		cout << 'L';
	}
	cout << 'U' << endl;

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define EPS 1e-10
using namespace std;
typedef long long ll;
struct Point{
	double x,y;
	Point(double x = 0.0,double y = 0.0): x(x),y(y) {}
	Point operator + (Point p){
		return Point(x + p.x,y + p.y);
	}
	Point operator - (Point p){
		return Point(x - p.x,y - p.y);
	}
	Point operator * (double lambda){
		return Point(x * lambda,y * lambda);
	}
	Point operator / (double lambda){
		return Point(x / lambda,y / lambda);
	}
	Point neg(){//negative.
		return Point(-x,-y);
	}
	double norm(){
		return x * x + y * y;
	}
	double abs_(){
		return sqrt(norm());
	}
	bool operator == (const Point &p)const
	{
		return abs(x - p.x) < EPS && abs(y - p.y) < EPS;
	}
	bool operator < (const Point &p)const
	{
		if(abs(x - p.x) < EPS) return y < p.y;
		else return x < p.x;
	}
};
typedef Point Vector;
struct Segment{
	Point p1,p2;
	Segment(Point p1 = Point(),Point p2 = Point()): p1(p1),p2(p2) {}
};
typedef Segment Line;
struct Circle{
	Point c;
	double r;
	Circle(Point c = Point(),double r = 0.0): c(c),r(r) {}
};
typedef vector<Point> Polygon;
double dot(Vector a,Vector b){
	return a.x * b.x + a.y * b.y;
}
double det(Vector a,Vector b){
	return a.x * b.y - b.x * a.y;
}
Vector rot(Vector a,double theta){//rotate.
	double x1 = cos(theta) * a.x - sin(theta) * a.y;
	double y1 = sin(theta) * a.x + cos(theta) * a.y;
	return Point(x1,y1);
}
vector <Point> tangent(Circle o,Point p){//make sure tangents exist.
	Vector a = p - o.c;
	double theta = acos(o.r / a.abs_());
	Vector b = a / a.abs_() * o.r;
	vector <Point> res;
	res.push_back(o.c + rot(b,theta));
	res.push_back(o.c + rot(b,-theta));
	return res;
}
int main(){
	Circle o; Point p;
	scanf("%lf%lf",&p.x,&p.y);
	scanf("%lf%lf%lf",&o.c.x,&o.c.y,&o.r);
	vector <Point> ans = tangent(o,p);
	sort(ans.begin(),ans.end());
	for(int i=0;i<(int)ans.size();i++){
		printf("%.10f %.10f\n",ans[i].x,ans[i].y);
	}
	return 0;
}



Measured memory_bytes: 3496
#include <iostream>
#include <iomanip>
#include <string>
#include <set>
using namespace std;

void Main() {
    // input
    string S;
    cin >> S;


    // translate
    set<char> chars;
    for (auto c: S) {
        chars.insert(c);
    }


    // output
    if (chars.size() != 1) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }


}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3648
#include<iostream>

using namespace std;

int main(){

  int n,m,p,sum=0,k;

  while(cin>>n>>m>>p){

    if(n==0&&m==0&&p==0){
      break;
    }

      int x[n];
      for(int i=0;i<n;i++){
	cin>>x[i];
      }

      if(x[m-1]==0){
	cout<<0<<endl;
      }else{

	for(int t=0;t<n;t++){

	    sum=sum+x[t];

	}

	sum=sum*100;

	k=sum-sum*p/100;
      

    
      cout<<k/x[m-1]<<endl;
      }

      sum=0;
    
    }

  return 0;
}

Measured memory_bytes: 2980
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1e9;
const long long LINF = 1LL << 50;
#define int long long

int a[10];
int n = 0;
int ans = 0;
void dfs(int i, int sum, int now) {
	if (i == n - 1) {
		ans += sum + now;
	}
	else {
		dfs(i + 1, sum + now, a[i + 1]);
		dfs(i + 1, sum, now * 10 + a[i + 1]);
	}
}
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s; cin >> s;
	n = s.size();
	rep(i, s.size()) {
		a[i] = s.at(i) - '0';
	}
	dfs(0, 0, a[0]);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>//D
using namespace std;
int gcd(long long a,long long b)
{
	if(b==0)
		return a;
	return gcd(b,a%b);
}
int main()
{
	long long a,b,c,d,i;
	long long ans1=0,ans2=0,ans3=0;
	cin>>a>>b>>c>>d;
	long  long f=0;
	f=c*d/gcd(c,d);
	ans1=b/c-(a-1)/c;
	ans2=b/d-(a-1)/d;
	ans3=b/f-(a-1)/f;
	cout<<b-a+1-ans1-ans2+ans3;
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n = I()
s = S()
pre = s[0]
cnt = 1
for i in range(1, n):
    if pre != s[i]:
        cnt += 1
        pre = s[i]

print(cnt)



Measured memory_bytes: 40688
#include <bits/stdc++.h>

using namespace std;

#define pb push_back

#define ll long long int

#define max 1000000

int main(){
    
    ll n;
    cin>>n;
    int num;
    int a=0;
    vector<int> v;
    for(int i=0; i<n; i++){
        cin>>num;
        v.pb(num);
        a=a^num;
    }
    
    for(int i=0; i<n; i++){
        v[i]=a^v[i];
        cout<<v[i]<<" ";
    }
    
    return 0;
}

Measured memory_bytes: 4320
#include <bits/stdc++.h>
using namespace std;

int a[20], top = 0;

int main()
{
	long long n;
	cin >> n;
	int ans = 0;
	while (n) {
		a[++top] = n%10, n /= 10;
		ans += a[top];
	}
	for (int i = top; i >= 1; i--) {
		if (a[i] == 0) continue;
		int cur = 0;
		for (int j = top; j > i; j--) cur += a[j];
		cur += a[i]-1+9*(i-1);
		ans = max(ans, cur);
		// cerr << cur << endl;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func InsertionSort(a []int, g int) int {
	var count int
	for i := g; i < len(a); i++ {
		v := a[i]
		j := i - g
		for j >= 0 && a[j] > v {
			a[j+g] = a[j]
			j = j - g
			count++
		}
		a[j+g] = v
	}
	return count
}

func ShellSort(a []int) int {
	var count int
	g := make([]int, 0)
	for i := 1; i <= len(a); i = 3*i + 1 {
		g = append(g, i)
	}
	fmt.Println(len(g))
	for i := len(g) - 1; i >= 0; i-- {
		count += InsertionSort(a, g[i])
		fmt.Print(g[i])
		if i > 0 {
			fmt.Print(" ")
		} else {
			fmt.Println()
		}
	}
	return count
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)

	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(r, &a[i])
	}

	fmt.Println(ShellSort(a))
	for _, v := range a {
		fmt.Println(v)
	}
}



Measured memory_bytes: 17476
#include <iostream>
using namespace std;


int main(int argc, const char * argv[]) {
    int a, b, c;
    
    cin >> a >> b >> c;
    
    if(a < b && b < c){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int>h(n);
    for(int i=0;i<n;i++){
        cin >> h[i];
    }
    for(int i=n-1;i>=1;i--){
        if(h[i]>=h[i-1])continue;
        if(h[i]+1==h[i-1])h[i-1]--;
        if(h[i]+1<h[i-1]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i, n, m) for(int (i) = (n); (i) < (m); i++)
using namespace std;
using ll = long long;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];

    int sum = 0;
    ll cnt = 0;
    int i, j;
    i = 0;
    j = 0;
    while (i < n)
    {
        if (sum & a[j])
        {
            cnt += (ll)(j - i);
            sum -= a[i];
            ++i;
        }
        else
        {
            sum += a[j];
            ++j;
        }

        if (j > n - 1)
        {
            cnt += (ll)(n - i)*(n - i + 1) / 2;
            break;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>


using namespace std;
int main() {
	int x, a, b,q,ans;
	cin >> x >> a >> b;
	q =(x - a) / b;
	cout << x - a - q * b << endl;
	return 0;
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

int n, k;
long long s;

int main(){
	
	cin >> n >> k ;
	
	for( int i = k + 1 ; i <= n ; i++ ){
		s += ( n / i ) * ( i - k );
		if( n % i == 0 ) continue;
		if( n % i > k - 1 ) s += ( n % i ) - (k - 1);
		if( k == 0 ) s--;	
	} 
	
	cout << s << endl;
	
}

Measured memory_bytes: 256
N,M,K=map(int,input().split())

p=[i for i in range(N)]
r=[0]*N

def find(x):
  if p[x]==x:
    return x
  else:
    p[x]=find(p[x])
    return p[x]

def unite(x,y):
  x=find(x)
  y=find(y)
  if x==y:
    return
  if r[x]<r[y]:
    p[x]=y
  else:
    p[y]=x
    if r[x]==r[y]:
      r[x]+=1

nc=[1]*N
f=[0]*N

for i in range(M):
  a,b=map(int,input().split())
  nc[a-1]+=1
  nc[b-1]+=1
  unite(a-1,b-1)

for i in range(K):
  c,d=map(int,input().split())
  if find(c-1)==find(d-1):
    nc[c-1]+=1
    nc[d-1]+=1

for i in range(N):
  f[find(i)]+=1

print(*[f[find(i)]-nc[i] for i in range(N)])


Measured memory_bytes: 14888
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

ll n;

ll check(ll x){
  ll n1 = n;
  for(int i = x; i > 0; i--){
    if(n1-i>=0)n1-=i;
  }
  if(n1==0)return 1;
  return 0;
}

int main() {
  cin>>n;
  long long low = 0;
  long long high = n;

  while(low < high){
    long long mid = (high + low) >> 1;

    if(check(mid) == 1){
      high = mid;
    }
    else{
      low = mid + 1;
    }
  }
  cout << low << endl;
  return 0;
}

Measured memory_bytes: 256
using System;

public class Hello{
    public static void Main(){
        int a = int.Parse(Console.ReadLine());
        int b = int.Parse(Console.ReadLine());
        
        int[] arr = {1, 2, 3};
        
        arr[a-1] = 0;
        arr[b-1] = 0;
        
        int ans = 0;
        for(int i=0; i<3; i++){
            ans += arr[i];
        }
        
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11220
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <numeric>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <tuple>

using namespace std;

#define int long long

#define rep(i,n) for(int i = 0; i<n ; i++)
#define FOR(i,a,n) for(int i=a; i<n; i++)
#define REPSTR(i,s) for(int i=0; (s)[i]; i++)
#define REPITR(i,s) for(auto i=(s).begin(); i!=(s).end();i++)

#define RANGE(a,i,b) ((a)<=(i)&&(i)<=(b))

#define pb push_back
#define mp make_pair

#define ALL(a) begin(a), end(a)

#define EXIST(s,x) ((s).find(x)!=(s).end())

#define SET(a,c) memset(a,c,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))

#ifdef _DEBUG
#define DEBUG(x) cerr<<#x<<":"<<x<<endl
#else
#define DEBUG(x)
#endif

#define PRINTJOIN(x,n) rep(i,n){if(i)cout<<" ";cout<<x[i];}cout<<endl 

#define INF 1001001001
#define LLINF 1001001001001001001LL

typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef stringstream SS;

#define PQ priority_queue

#define FST first
#define SEC second

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

template<typename T>
class UnionFind {
    public:
    vector<T> parent;
    vector<T> rank;
    UnionFind() {}
    UnionFind(T n):parent(n), rank(n){
        rep(i, n) {
            parent[i]=i;
        }
        fill(ALL(rank), 0);
    }
    T root(T x) {
        if(parent[x] == x){
            return x;
        } else {
            parent[x] = root(parent[x]);
            return parent[x];
        }
    }
    bool same(T x, T y) {
        return root(x) == root(y);
    }
    void unite(T x, T y) {
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (rank[x] < rank[y]) {
            parent[x] = y;
        } else {
            parent[y] = x;
            if(rank[x] == rank[y]) rank[x]++;
        }
    }
};

signed main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n;
    cin>>n;
    priority_queue<tuple<int,int,int>, vector<tuple<int,int,int>>, greater<tuple<int,int,int>>> q;
    rep(i,n)rep(j,n){
        int t;cin>>t;
        if(t != -1) {
            q.push(make_tuple(t, i, j));
        }
    }
    UnionFind<int> uf(n);
    int ans = 0;
    while(!q.empty()) {
        tuple<int,int,int> t = q.top();q.pop();
        int c,x,y;
        c=get<0>(t);
        x=get<1>(t);
        y=get<2>(t);
        if(!uf.same(x,y)) {
            ans += c;
            uf.unite(x,y);
        }
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3316
import math
import collections

n = int(input())
A = list(map(int, input().split()))

equal = 0
elements = collections.Counter(A)
equal = sum([v * (v - 1) // 2 for v in elements.values()])

for i in range(n):
    equal_i = elements[A[i]] - 1
    print(equal - equal_i)

Measured memory_bytes: 26780
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#define MAX 100001
using namespace std;

class Queue{
    vector<pair<string, int> > q;
    int head = 0;
    int tail = 0;
public:
    Queue(){
        q.resize(MAX);
    }
    bool is_empty(){
        if (head == tail) return true;
        return false;
    }
    void enqueue(pair<string, int> num){
        q[tail] = num;
        tail = (tail + 1) % MAX;
    }
    pair<string, int> dequeue(){
        pair<string, int> ret = q[head];
        head = (head + 1) % MAX;
        return ret;
    }
};

int main(){
    int n, q;
    cin >> n >> q;
    Queue que1;
    for (int i = 0; i < n; i++) {
        string p;
        int num;
        cin >> p >> num;
        que1.enqueue(make_pair(p, num));
    }
    Queue que2;
    int time_ = 0;
    while(!que1.is_empty()) {
        pair<string, int> front = que1.dequeue();
        if (front.second <= q) {
            time_ += front.second;
            front.second = time_;
            que2.enqueue(front);
        } else {
            front.second -= q;
            time_ += q;
            que1.enqueue(front);
        }
    }
    while (!que2.is_empty()) {
        pair<string, int> front = que2.dequeue();
        cout << front.first << " " << front.second << endl;
    }
    return 0;
}

Measured memory_bytes: 8384
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <cmath>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}
int N,A,B,C;
vector<int>p;
vector<int>l(100);
int ans=999999999;
void score(vector<int>p){
  int suma=0,sumb=0,sumc=0,cnta=0,cntb=0,cntc=0;
  for(int i=0;i<N;i++){
    if(p[i]==1){suma+=l[i];cnta++;}
    if(p[i]==2){sumb+=l[i];cntb++;}
    if(p[i]==3){sumc+=l[i];cntc++;}
  }
  if(cnta==0||cntb==0||cntc==0){return;}
  int cost=abs(suma-A)+abs(sumb-B)+abs(sumc-C)+10*(cnta+cntb+cntc-3);
  ans=min(ans,cost);
  return ;
}
void dfs(vector<int>p){
 if(p.size()==N){
   score(p);
   return ;
 }
 for(int i=0;i<4;i++){
   p.push_back(i);
   dfs(p);
   p.pop_back();
 }
}

int main(){
  cin>>N>>A>>B>>C;
  for(int i=0;i<N;i++){
    cin>>l[i];
  }
  dfs(p);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
//typedef pair<int,int> P;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef pair<ll, pair<int, int>> P;
typedef pair<ll,pair<ll,ll>> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2147483600;//10^9
int INFM =100000000;
ll MOD  = 1000000007;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b){//計算量はO(log(max(a,b))
    if(b == 0) return a;
    return gcd(b, a % b);
}

int main(){
    int T;
    cin >> T;
    for(int i = 0; i < T; i++){
        ll a,b,c,d;
        bool l = 1;
        cin >> a >> b >> c >> d;
        ll g = gcd(b, d);
        if(b - g + (a%g) > c){
            l = 0;
        }
        if(a < b){
            l = 0;
        }
        else if(b > d){
            l = 0;
        }
        else if(c >= b){
            l = 1;
        }
        if(l){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 256
function main(input) {
    args = input.split(" ")
    const a = parseInt(args[0], 10);
    const b = parseInt(args[1], 10);
    if(a * b % 2 === 0){
        console.log("Even");
    }
    else{
        console.log("Odd");
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064
using System;
class Mainclass
{
  static void Main ()
  {
    string[] array = new string [1];
    array = Console.ReadLine().Split(' ');
    int sum = 0;
    foreach(var i in array){
      sum += int.Parse(i);
    }
    var mean = Math.Ceiling((double)sum / 2);
    Console.WriteLine(mean);
  }
}

Measured memory_bytes: 11220
N, M = map(int, input().split())
a =[list(map(int, input().split())) for i in range(N)]
#print(a)
list_ = set([i+1 for i in range(M)])
#print(list_)

for j in range(N):
    list_ &= set(a[j][1:])
    #print(list_)

if len(list_) !=0:
    print(len(list_))
else:
    print(0)

Measured memory_bytes: 3060
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
typedef pair<int,string>P;
int main(){
	int n;
	cin>>n;
	map<P,int> data;
	for(int i =0;i < n;i++){
		string str;
		int x;
		cin>>str>>x;
		data[P(str.length(),str)]+=x;
	}
	map<P,int>::iterator it =data.begin();
	while(it!=data.end()){
		cout <<(*it).first.second<<" "<<(*it).second<<endl;
		it++;
	}
	return 0;
}

Measured memory_bytes: 1224
def main():
    N, x = map(int, input().split())
    A = list(map(int, input().split()))
    cnt = 0
    for i in range(1,N):
        tmp = A[i] + A[i-1]
        if tmp > x:
            tmp -= x
            cnt += tmp
            A[i] = max(0, A[i]-tmp)

    print(cnt)

if __name__ == "__main__":
    main()

Measured memory_bytes: 85936
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    int a, b; cin >> a >> b;
    if(b==1) cout << 0 << endl;
    else if(a>=b) cout << 1 << endl;
    else {
        if((b-a)%(a-1)==0){
            cout << 1+(b-a)/(a-1) << endl;
        }else{
            cout << 1+(b-a)/(a-1)+1 << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void) {

        double S,W,H,x,y;

        scanf("%lf %lf %lf %lf",&W,&H,&x,&y);
        S = W*H/2;
        int P = (x == W/2 && y == H/2)? 1 : 0;
        printf("%lf %d\n",S,P);

        return 0;

}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
#include <numeric>
#include <unordered_map>

using namespace std;
#define MAX_P 20001

long long N;
long long a[200001];


int main() {
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> a[i];
    }

    unordered_map<int, vector<int>> mp;
    for(int idx=0; idx<N ;idx++){
        mp[a[idx]].push_back(idx);
    }

    int length = 0;
    int last_idx=-1;
    for(int num=1; num<=N; num++){
        if(mp[num].size()==0)
            break;
        auto iter = lower_bound(mp[num].begin(), mp[num].end(), last_idx);
        if(iter==mp[num].end())
            break;
        last_idx=*iter;
        length++;
    }

    if(length == 0)
        cout << -1 << endl;
    else
        cout << N-length << endl;
}

Measured memory_bytes: 19528
from itertools import accumulate
from bisect import bisect_left
N = int(input())
A = list(map(int, input().split()))
A = list(accumulate(A))

ans = float('inf')
# 切る位置を全探索
for mid in range(1, N):
    L_target, R_target = A[mid] // 2, (A[mid] + A[-1]) // 2
    L_index, R_index = bisect_left(A, L_target), bisect_left(A, R_target)
    if abs(A[L_index - 1] - L_target) < abs(A[L_index] - L_target):
        L_index -= 1
    if abs(A[R_index - 1] - R_target) < abs(A[R_index] - R_target):
        R_index -= 1

    P, Q, R, S = A[L_index], A[mid]-A[L_index], A[R_index]-A[mid], A[-1]-A[R_index]
    ans = min(ans, max(P, Q, R, S) - min(P, Q, R, S))

print(ans)


Measured memory_bytes: 24292
#include <stdio.h>

int main(){
    int N;
    
    scanf("%d",&N);
    if(N>=0 &&  N<=127){
        if(N>=65 && N<=90) printf("1\n");
        else if(N>=97 && N<=122) printf("2\n");
        else printf("0\n");
    }
    return 0;
}



Measured memory_bytes: 2100
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int H = sc.nextInt();
            int W= sc.nextInt();
            if (H == 0 && W == 0) {
                break;
            }else{
                for(int i = 0;i < H;i++){
                    for(int j = 0;j < W;j++){
                        System.out.printf("#");
                    }
                    System.out.printf("\n");
                }
                System.out.printf("\n");
            }
        }
    }
}



Measured memory_bytes: 62952
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;

  int ans;

  int dp[1000000];

int32_t main()
{


    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    IOS



    int x;
    cin >> x;
    vector<int> v = {100,101,102,103,104,105};
    dp[0] = 1;

    for(int i = 0; i <= x; i++)
    { 
      for(int j = 0; j < v.size(); j++)
      {
        if(i >= v[j] and dp[i-v[j]])
        {
          dp[i] = true;
          break;
        }
      }
    }

    cout << dp[x];

    return 0;
}


Measured memory_bytes: 4276
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e10+10;

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

signed main(){
  int n,k;
  cin>>n>>k;
  double ans=0;
  FOR(i,1,n){
    double p=1,t=i;
    while(k>t){
      p/=2;t*=2;
    }
    ans+=p;
  }
  ans/=n;

  cout<<setprecision(15)<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	A, B, C := getInt(), getInt(), getInt()

	ans := 0
	for !(A == B && B == C) {
		if A > B && A > C {
			B++
			C++
		} else if B > A && B > C {
			A++
			C++
		} else if C > A && C > B {
			A++
			B++
		} else if A == B && A > C {
			C += 2
		} else if A == C && A > B {
			B += 2
		} else if B == C && C > A {
			A += 2
		}
		ans++
	}
	out(ans)
	// a := max(A, max(B, C))
	// d0 := abs(A - a)
	// d1 := abs(B - a)
	// if d0 == 0 {
	// 	d0 = abs(C - a)
	// }
	// if d1 == 0 {
	// 	d1 = abs(C - a)
	// }

	// out(d0, d1)
	// ans := min(d0, d1)
	// d0 -= ans
	// d1 -= ans
	// out(ans, d0, d1)
	// d0 = max(d0, d1)
	// out(d0)
	// ans += d0 / 2
	// if d0%2 == 1 {
	// 	ans += 2
	// }
	// out(ans)
}


Measured memory_bytes: 640
t = 0
h = 0

n = gets.chomp.to_i
n.times do
  s = gets.chomp.split
  t += 3 if s[0] > s[1]
  h += 3 if s[0] < s[1]
  if s[0] == s[1]
    t += 1
    h += 1
  end
end

puts "#{t} #{h}"

Measured memory_bytes: 6104
def resolve():
    H, W = [int(i) for i in input().split()]
    A = [input() for _ in range(H)]
    skipC = [False for _ in range(W)]
    skipR = [False for _ in range(H)]
    for i in range(H):
        if A[i] == "".join(["." for _ in range(W)]):
            skipR[i] = True
    for i in range(W):
        for j in range(H):
            if A[j][i] != ".":
                break
        else:
            skipC[i] = True

    for i in range(H):
        if skipR[i]:
            continue
        for j in range(W):
            if skipC[j]:
                continue
            print(A[i][j], end="")
        print("")


resolve()


Measured memory_bytes: 4468
def solve():
    n = int(input())
    oc = [list(map(int, input().split())) for _ in range(n)]
    prof = [list(map(int, input().split())) for _ in range(n)]

    ans = -9999999999

    for a in range(1, 1 << 10):
        res = 0
        for i in range(n):
            cnt = 0
            for x in range(10):
                if (a >> x) % 2 == 1 and oc[i][x] == 1:
                    cnt += 1
            res += prof[i][cnt]
        ans = max(ans, res)
    print(ans)


solve()


Measured memory_bytes: 9160
r,b,g,n=map(int,input().split())
cnt=0
if r==1 and b==1:
  for i in range(n//g+1):
    cnt+=n+1-g*i
else:
  for i in range(n//r+1):
    for j in range(n//b+1):
      if r*i+b*j==n:
        cnt+=1
      elif (n-r*i-b*j)%g==0 and (n-r*i-b*j)//g>=1:
        cnt+=1
print(cnt)

Measured memory_bytes: 3064
import java.io.*;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.InputStreamReader;
//import java.io.*;

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

	  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	  int n = Integer.parseInt(br.readLine());
    //String str = br.readLine();
	  String A[] = new String[n + 1];
    String A2[] = new String[n + 1];
  
	  /**/for(int i = 0;i < n;i++){
      A[i] = br.readLine();
		   A2[i] = A[i];
    }
    
	  //String Ar[] = new String[n];
	  //String A2r[] = new String[N];
    //Ar = BubbleSort(A, n);
    mergeSort(A, 0, n);
	  //if(Cr.equals(C)){
		  //System.out.println("Stable");
	  //}
	  //else System.out.println("Not Stable");
	  quickSort(A2, 0, n - 1);
	  if(Arrays.equals(A, A2)){
		  System.out.println("Stable");
	  }
    else System.out.println("Not stable");
    for(int i = 0;i < n;i++){
      System.out.println(A2[i]);
      //if(i != n - 1) System.out.print(" ");
    }
    //System.out.println();
  }
  
	public static String[] BubbleSort(String[] A, int n){
		for(int i = 0;i < n - 1;i++){
			for(int j = n - 1;j > i;j--){
				if(A[j].charAt(2) < A[j - 1].charAt(2)){/*charAtの引数:1->2*/
					String tmp = A[j];
					A[j] = A[j - 1];
					A[j - 1] = tmp;
				}
			}
		}
		/*for(int i = 0;i < N;i++){
			 System.out.print(C[i]);
			 if(i != N - 1) System.out.print(" ");
		}
		System.out.println();*/
		return A;
	} 
  static void quickSort(String[] A, int p, int r){
    if(p < r){
      int q = partition(A, p, r);
      quickSort(A, p, q - 1);
      quickSort(A, q + 1, r);
    }
    //return A;
  }
  static int partition(String[] A, int p, int r){
    int x = Integer.parseInt(A[r].substring(2));
    int i = p - 1;
    for(int j = p;j < r;j++){
      if(Integer.parseInt(A[j].substring(2)) <= x){
        i++;
        String tmp = A[i];
        A[i] = A[j];
        A[j] = tmp;
      }
    } 
    String tmp = A[i + 1];
    A[i + 1] = A[r];
    A[r] = tmp;

    return i + 1;
  }
  static void mergeSort(String[] A, int l, int r){
    if(l + 1 < r){
      int m = (l + r) / 2;
      mergeSort(A, l, m);
      mergeSort(A, m, r);
      merge(A, l, m, r);
    }
  }
  static void merge(String[] A, int l, int m, int r){
   int n1 = m - l;
   int n2 = r - m;
   String[] L = new String[n1 + 1];
   String[] R = new String[n2 + 1];
   
   for(int i = 0;i < n1;i++) L[i] = A[l + i];
   for(int i = 0;i < n2;i++) R[i] = A[m + i];

   L[n1] = "I 1000000001";
   R[n2] = L[n1];

   int i = 0, j = 0;
    for(int k = l;k < r;k++){
      if(Integer.parseInt(L[i].substring(2)) <= Integer.parseInt(R[j].substring(2))){
        A[k] = L[i];
        i++;
      }
      else {
        A[k] = R[j];
        j++;
      }
    }
  }
}



Measured memory_bytes: 121172
#include<bits/stdc++.h>
#define ll long long int
#define pii pair<int,int>
#define F first
#define S second
#define mod 1000000007
///distance(s.begin(),s.lower_bound(101))
using namespace std;
///dp[i][j]=j lessons skipped in first i days.
///mn[i][j]=min hours needed to spend in ith day to skip skip exactly j lessons.



int main(){
    string s;cin >>s;
    if(s[2]==s[3] && s[4]==s[5]){
        cout <<"Yes"<<endl;
    }else{
    cout <<"No"<<endl;}
}


Measured memory_bytes: 256
A, B, C, D, E, F = map(int, input().split())

total = 100 * A
sugar = 0

for a in range(F// (100 * A) + 1):
    for b in range((F - (100 * a)) // (100 * B) + 1):
        tmp_water = 100 * (A * a + B * b)
        if tmp_water == 0:
            continue
        
        maxC = min(tmp_water // 100 * E, F - tmp_water) #溶ける量とビーカーの質量の問題
        
        if maxC <= 0:
            continue

        # print (tmp_water)

        for c in range(0, maxC + 1, C): #Cグラム刻みで増やす
            # print ('c', c)
            left = maxC - c
            d = (left // D) * D
            tmp_sugar = c + d
            tmp_total = tmp_sugar + tmp_water
            if sugar * tmp_total < tmp_sugar * total:
                total = tmp_total
                sugar = tmp_sugar

print (total, sugar)
            

Measured memory_bytes: 3064
#include <bits/stdc++.h>

using namespace std;

#define int			long long
#define endl		"\n"
#define ff			first
#define ss			second
#define mod			1000000007
#define inf			1e18
#define IOS			ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

void dfs(int src, vector<vector<int>>& adj, vector<bool>& vis) {
	vis[src] = 1;

	for (int to : adj[src]) {
		if (!vis[to])
			dfs(to, adj, vis);
	}
}

int32_t main() {

	IOS;

	int n , m;
	cin >> n >> m;

	vector<vector<int>> adj(n);
	vector<bool> vis(n);

	int a, b;

	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		a--, b--;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}

	int cc = 0;

	for (int i = 0; i < n; i++) {
		if (!vis[i]) {
			dfs(i, adj, vis);
			cc++;
		}
	}

	cout << cc - 1;

	return 0;
}

Measured memory_bytes: 10312