stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <string.h>

using namespace std;

#define ll long long

ll n, k, h[100009], dp[100009];

ll solve(ll ind)

{

	if (ind == n - 1)

		return 0;

	ll jump = 1e18;

	if (dp[ind] != -1)

		return dp[ind];

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

	{

		if (i + ind < n)

			jump = min(jump, abs(h[ind] - h[ind + i]) + solve(ind + i));

	}

	return dp[ind] = jump;

}

int main()

{

	cin >> n >> k;

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

		cin >> h[i];

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

	cout << solve(0);

}

// Faster C++ solution for the same problem (measured speedup: 1.8019164029629986x):
#include<bits/stdc++.h>

#define ull unsigned long long

#define ll long long

#define pb push_back

#define endl '\n'

#define line cout<<"----------------------"<<endl

#define mp make_pair

#define mod 1000000007

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)

#define filein freopen("input.txt","r",stdin)

#define fileout freopen("output.txt","w",stdout)

using namespace std;

const ll  mx=300009;

ll  ara[mx];

ll  cost[mx];

int main()

{

    ll n,k;

    cin>>n>>k;

    for(ll  i=1;i<=n;i++) cin>>ara[i];

    cost[1]=0;

    cost[2]=abs(ara[2]-ara[1]);

    for(ll  i=3;i<=n;i++)

    {

        cost[i]=LLONG_MAX;

        for(ll  j=1;j<=min(i-1,k);j++)

        {

            cost[i]=min(cost[i],cost[i-j]+abs(ara[i]-ara[i-j]));

        }

    }

    cout<<cost[n]<<endl;





}
// Slower C++ solution:
#include <cstdio>

#include <vector>

#include <algorithm>

#include <string>

#include <map>

#include <set>

#include <queue>

#include <cstring>



using namespace std;



#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)

#define rep(i,n) reep(i, 0, n) 



typedef vector<int> vi;

typedef vector<vi> vvi;

typedef pair<int,int> pii;



pii fit(const vvi& window, const vvi& pic, int y, int x)

{

	int m = pic.size();

	pii ans(-1, -1);

	rep(i, m) rep(j, m){

		if(pic[i][j] == -1)

			continue;

		

		if(window[y+i][x+j] != pic[i][j]){

			return pii(-1, -1);

		}else if(ans.first == -1)

			ans = pii(y+i, x+j);

	}

	return ans;

}



void rotate(vvi& p)

{

	int m = p.size();

	vvi next(m, vi(m));

	rep(i, m) rep(j, m)

		next[i][j] = p[m-j-1][i];

	

	p.swap(next);

}



int main()

{

	int n, m;

	while(scanf("%d%d", &n, &m), n){

		vvi window(n, vi(n));

		rep(i, n) rep(j, n)

			scanf("%d", &window[i][j]);

		

		vvi pic(m, vi(m));

		rep(i, m) rep(j, m)

			scanf("%d", &pic[i][j]);

		

		pii ans(-1, -1);

		rep(i, n-m+1) rep(j, n-m+1){

			rep(k, 4){

				ans = fit(window, pic, i, j);

				if(ans.first != -1){

					i=n-m+1;

					j=n-m+1;

					break;

				}

				rotate(pic);

			}

		}

		

		if(ans.first == -1)

			puts("NA");

		else

			printf("%d %d\n", ans.second+1, ans.first+1);

	}

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.372616875027842x):
#include <cstdio>

#include <vector>

#include <algorithm>

#include <string>

#include <map>

#include <set>

#include <queue>

#include <cstring>



using namespace std;



#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)

#define rep(i,n) reep(i, 0, n) 



typedef vector<int> vi;

typedef vector<vi> vvi;

typedef pair<int,int> pii;



int m;



pii fit(const int window[][100], const int pic[][50], int y, int x)

{

	pii ans(-1, -1);

	rep(i, m) rep(j, m){

		if(pic[i][j] == -1)

			continue;

		

		if(window[y+i][x+j] != pic[i][j]){

			return pii(-1, -1);

		}else if(ans.first == -1)

			ans = pii(y+i, x+j);

	}

	return ans;

}



void rotate(int p[][50])

{

	int next[50][50];

	rep(i, m) rep(j, m)

		next[i][j] = p[m-j-1][i];

	

	rep(i, m) rep(j, m)

		p[i][j] = next[i][j];

}



int main()

{

	int n;

	while(scanf("%d%d", &n, &m), n){

		int window[100][100];

		rep(i, n) rep(j, n)

			scanf("%d", &window[i][j]);

		

		int pic[50][50];

		rep(i, m) rep(j, m)

			scanf("%d", &pic[i][j]);

		

		pii ans(-1, -1);

		rep(i, n-m+1) rep(j, n-m+1){

			rep(k, 4){

				ans = fit(window, pic, i, j);

				if(ans.first != -1){

					i=n-m+1;

					j=n-m+1;

					break;

				}

				rotate(pic);

			}

		}

		

		if(ans.first == -1)

			puts("NA");

		else

			printf("%d %d\n", ans.second+1, ans.first+1);

	}

	

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef long long int lli;

typedef long double ld;

const int oo = 1e9;

const int mod = 1e9+9;

/*ll gcd(ll x, ll y){return (y ? gcd(y, x%y) : x); }

*ll lcm(ll x, ll y){return x*(y/gcd(x,y));}

*void exEuclid(int a, int b){

	if(b==0){x = 1; y=0; d=a; return ;}

	exEuclid(b, a%b);

	int x1=y;

	int y1=x-(a/b)*y;

	x=x1;

	y=y1;

} 

* */

//===========================================================//

const int nax = 1e5+103;

int n, k;

int dp[nax];

int a[nax];

int f(int i){

	if (i==n-1) return 0;

	if(dp[i]!=-1) return dp[i];

	int ans = abs(a[i]-a[i+1])+f(i+1);

	for(int j=2; j<=k; j++){

		if(i+j<n) ans = min(ans, abs(a[i]-a[i+j])+f(i+j));

	}

	return dp[i]=ans;

}

int main(){

	cin>>n>>k;

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

	memset(dp, -1, sizeof dp);

	cout<<f(0)<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.3443607215321693x):
#include <bits/stdc++.h>

#include <fstream>

#define inf INFINITY

#define file freopen( "input.txt" , "r" , stdin) ; freopen( "output.txt" , "w" , stdout) ; 

#define Gamed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define _3102_ main()

#define endl '\n'

typedef long long ll ;

typedef unsigned long long ull ; 

typedef long double ld ; 

using namespace std ;

const int N = 1e5+100  ; 

const ll mod = 1e9 + 7  ;







int _3102_ {

    Gamed

    ll n , k , arr[N] , dp[N] ; 

    cin >> n >> k ; 

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

        cin >> arr[i] ; 

    }

    dp[0] = 0 ;  

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

        ll ans = inf , cnt = k; 

        for ( int j = i - 1 ; j >= 0 && cnt > 0 ; j -- , cnt --){

            ans = min (ans, dp[j] + abs(arr[i]-arr[j])) ;

        }

        dp[i] = ans ; 

    }

    cout << dp[--n] << endl ; 

    return 0;

}
// Slower C++ solution:
#include<iostream>

#define loop(i,a,b) for(int i=a;i<b;i++)

#define rep(i,a) loop(i,0,a)

#define INF 100000

using namespace std;



struct place{

	int x,y;

};



int main(){

	int N;

	while(1){

		cin>>N;

		if(N==0)break;

		int n[N],p[N];

		loop(i,1,N)cin>>n[i]>>p[i];

		bool dt[401][401];

		rep(i,401)rep(j,401)dt[i][j]=false;

		dt[200][200]=true;

		place basyo[N];

		basyo[0].x=200;

		basyo[0].y=200;

		loop(i,1,N){

			int dirx,diry;

			if(p[i]==0){

				dirx=-1;

				diry=0;

			}else if(p[i]==1){

				dirx=0;

				diry=1;

			}else if(p[i]==2){

				dirx=1;

				diry=0;

			}else{

				dirx=0;

				diry=-1;

			}

			int nx=basyo[n[i]].x+dirx;

			int ny=basyo[n[i]].y+diry;

			dt[ny][nx]=true;

			basyo[i].x=nx;

			basyo[i].y=ny;

		}

		int minix,miniy,maxx,maxy;

		minix=miniy=maxx=maxy=INF;

		rep(i,401){

			rep(j,401){

				if(dt[i][j]){

					miniy=i;

					break;

				}

			}

			if(miniy!=INF)break;

		}

		rep(i,401){

			rep(j,401){

				if(dt[j][i]){

					minix=i;

					break;

				}

			}

			if(minix!=INF)break;

		}

		for(int i=400;i>=0;i--){

			for(int j=400;j>=0;j--){

				if(dt[i][j]){

					maxy=i;

					break;

				}

			}

			if(maxy!=INF)break;

		}

		for(int i=400;i>=0;i--){

			for(int j=400;j>=0;j--){

				if(dt[j][i]){

					maxx=i;

					break;

				}

			}

			if(maxx!=INF)break;

		}

		int ansx=maxx-minix+1;

		int ansy=maxy-miniy+1;

		cout<<ansx<<" "<<ansy<<endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.608404764587034x):
#include<iostream>

#include<vector>

#include<algorithm>

#define loop(i,a,b) for(int i=a;i<b;i++)

#define rep(i,a) loop(i,0,a)

using namespace std;

typedef pair<int,int> pii;



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

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



int main(){

	int n;

	while(cin>>n,n){

		vector<pii> vec;

		vec.push_back(pii(0,0));

		int m,d;

		loop(i,1,n){

			cin>>m>>d;

			pii now=vec[m];

			now.first+=dx[d];

			now.second+=dy[d];

			vec.push_back(now);

		}

		int wmi=1e6,wma=-1*1e6,hmi=1e6,hma=-1*1e6;

		rep(i,vec.size()){

			wma=max(wma,vec[i].first);

			wmi=min(wmi,vec[i].first);

			hmi=min(hmi,vec[i].second);

			hma=max(hma,vec[i].second);

		}

		cout<<wma-wmi+1<<" "<<hma-hmi+1<<endl;

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int main(){

    long long s, i(1);

    scanf("%lld", &s);

    vector<long long> memo(1000100, -1);

    while(1){

        if(memo[s] >= 0)return 0 & printf("%lld", i);

        memo[s] = i;

        if(s & 1)s = 3 * s + 1;

        else s >>= 1;

        ++i;

    }

}

// Faster C++ solution for the same problem (measured speedup: 9.564795028217318x):
#include<bits/stdc++.h>

using namespace std;



int main(){

    long long s, i(1);

    scanf("%lld", &s);

    if(s == 4 || s == 2 || s == 1)return 0 & printf("%lld", 4);

    while(1){

        if(s == 4)return 0 & printf("%lld", i + 3);

        if(s & 1)s = 3 * s + 1;

        else s >>= 1;

        ++i;

    }

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define oo (1L<<62)

#define ll long long int



int N;

int K;

int h[100005];

ll memo[100005];

char vis[100005];



ll elJoshua(int n){

	if(n < 0) return oo;

	if(!n) return 0;

	if(vis[n]) return memo[n];

	vis[n] = 1;

	ll mini = oo;

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

        if(n>=i)

            mini = min(abs(h[n]-h[n-i])+elJoshua(n-i), mini);

    return memo[n] = mini;

}   



int main() {

	cin>>N>>K;

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

		cin>>h[i];

	cout<<elJoshua(N-1)<<"\n";

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.350242711211707x):
#include<cstdio>

#include<algorithm>



int main(){

  int s,k;

  long long st[100001],p[100001];

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

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

    scanf("%lld",&st[i]);

  }

  p[0]=0;

  p[1]=0;

  p[2]=(st[2]-st[1] < 0) ? st[1]-st[2] : st[2]-st[1];

  for(int i=3;i<=s;i++){

    p[i] = 1000000001;

  }

  for(int i=3;i<=s;i++){

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

      if(i-j>=1){

	long long tmp;

	tmp = (st[i]-st[i-j] < 0) ? st[i-j]-st[i] : st[i]-st[i-j];

	if(p[i] > p[i-j]+tmp){

	  p[i] = p[i-j]+tmp;

	}

	if(tmp == 0) break;

      }else{

	break;

      }

    }

  }

  printf("%lld\n",p[s]);

  return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cmath>

#include<algorithm>

#include<cstring>

using namespace std;



int h[100055],dp[100055];

const int inf = 0x3f3f3f;

int main()

{

	int n,k;

	

	memset(dp,inf,sizeof(dp));

	dp[0]=dp[1]=0;

	cin>>n>>k;

	//h[1]=inf;

	h[0]=inf;

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

		cin>>h[i];

		//dp[2]=

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

			for(int j=1;j<=k&&i-j>0;j++)

			{

				dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));

			//	cout<<dp[i]<<"  "<<dp[i-j]+abs(dp[i]-dp[i-j])<<endl;

			}



	cout<<dp[n]<<endl;

	return 0;

} 

//max(h[i],h[i-2])-min(h[i],h[i-2])

// Faster C++ solution for the same problem (measured speedup: 1.4063571799948138x):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

const int inf=0x3f3f3f3f;

const int N=2e5+5;

ll a[N],dp[N],n,k;

int main(){

	cin>>n>>k;

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

		cin>>a[i];

	dp[1]=0;

    dp[0]=0;

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

    	dp[i]=inf;

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

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

        {

            if(i-j<1) break;

            dp[i] = min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));

        }

		cout<<dp[n];

	return 0;

}
// Slower C++ solution:
#include <vector>

#include <iostream>

#include <algorithm>



using namespace std;



vector<vector<int> > G;



vector<bool> used;



vector<int> rings;



int rec(int pos)

{

    used[pos] = true; int ret = 1;

    

    for(int i = 0; i < rings[pos]; i++)

    {

        if(!used[G[pos][i]])

        {

            ret = max(ret, rec(G[pos][i]) + 1);

        }

    }

    

    used[pos] = false;

    

    return ret;

}



int main()

{

    int N, A, B;

    

    while(true)

    {

        scanf("%d", &N);

        

        if(N == 0) { break; }



        G = vector<vector<int> >(100, vector<int>());

        

        used = vector<bool>(100);

        

        rings = vector<int>(100);

    

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

        {

            scanf("%d", &A); A--;

            scanf("%d", &B); B--;

        

            G[A].push_back(B);

            G[B].push_back(A);

        }

        

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

        {

            rings[i] = G[i].size();

        }

        

        int nodes = 0;

        

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

        {

            if(rings[i])

            {

                nodes++;

            }

        }

    

        int ret = 0;

    

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

        {

            ret = max(ret, rec(i));

                

            if(ret == nodes) { break; }

        }

        

        printf("%d\n", ret);

    }

    

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.062615943153203x):
#include <stdio.h>

#include <algorithm>

#pragma warning(disable : 4996)

using namespace std;

int N, A, B, v[100], r[100], G[100][199];

int rec(int pos) {

	int ret = 0; v[pos] = 1;

	for (int i = 0; i < r[pos]; i++) {

		if (!v[G[pos][i]]) ret = max(ret, rec(G[pos][i]));

	}

	v[pos] = 0;

	return ret + 1;

}

int main() {

	while (scanf("%d", &N), N) {

		for (int i = 0; i < 100; i++) r[i] = 0;

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

			scanf("%d%d", &A, &B), A--, B--;

			G[A][r[A]++] = B, G[B][r[B]++] = A;

		}

		int ret = 0;

		for (int i = 0; i < 100; i++) ret = max(ret, rec(i));

		printf("%d\n", ret);

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <stdio.h>

using namespace std;

int n,k;

int main(){

    cin>>n>>k;

    int dem=0,num;

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

        cin>>num;

        if (num>=k) dem++;

    }

    cout<<dem;

}

// Faster C++ solution for the same problem (measured speedup: 5.243247350051517x):
#include <stdio.h>



int main()

{

    int n,k,ans=0;

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

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

    {

        int x;

        scanf("%d",&x);

        if(x>=k)ans++;

    }

    printf("%d\n", ans);

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<algorithm>





using namespace std;



const long long inf= 1e10+ 123;

const int mx=1e5+123;

int dp[mx], h[mx], n, k;



int solve( int i)

{

    if(i==n)

        return 0;



    if(dp[i]!= -1)

        return dp[i];





    int ret= inf;



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

    {

        if(i+j<=n)

            ret= min(ret, (abs(h[i]- h[i+j])+ solve(i+j)));

    }





    return dp[i]= ret;

}



int main()

{

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



    cin>> n >> k;

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

        cin>> h[i];



    cout<< solve(1)<< endl;



    return 0;

}




// Faster C++ solution for the same problem (measured speedup: 6.102291335833137x):
#include<cstdio>

#include<algorithm>



int main(){

  int s,k;

  long long st[100001],p[100001];

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

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

    scanf("%lld",&st[i]);

  }

  p[0]=0;

  p[1]=0;

  p[2]=(st[2]-st[1] < 0) ? st[1]-st[2] : st[2]-st[1];

  for(int i=3;i<=s;i++){

    p[i] = 1000000001;

  }

  for(int i=3;i<=s;i++){

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

      if(i-j>=1){

	long long tmp;

	tmp = (st[i]-st[i-j] < 0) ? st[i-j]-st[i] : st[i]-st[i-j];

	if(p[i] > p[i-j]+tmp){

	  p[i] = p[i-j]+tmp;

	}

	if(tmp == 0) break;

      }else{

	break;

      }

    }

  }

  printf("%lld\n",p[s]);

  return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define pb push_back

#define eb emplace_back

#define ff first

#define ss second

#define endl '\n'

#define int long long

typedef long long li;

const int N = 1e5 + 10;

int n;

int a[N];

int dp[N];

int k;

int solve(int i){



	if(i>=n-1)

		return 0;

	if(dp[i]!=INT_MAX)

		return dp[i];



//	dp[i] = abs(a[i] - a[i-1]) + solve(i+1);

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

		if(i+j>=n)

			break;

		dp[i] = min(dp[i] , abs(a[i]-a[i+j]) + solve(i+j));



	}

	return dp[i];

}

signed main(){

	cin>>n>>k;

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

		cin>>a[i];

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

		dp[i] = INT_MAX;

	//cout<<dp[0]<<" "<<dp[1]<<endl;

	cout<<solve(0)<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 1.802991781509421x):
#include <bits/stdc++.h>

using namespace std;



#define pb push_back

#define eb emplace_back

#define ff first

#define ss second

#define endl '\n'

#define boost ios::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL);

typedef long long li;

const int INF = 1e9 + 12;

#define int long long

const int N = 1e5 + 10;

int dp[N];

signed main(){



	int n,k;

	cin>>n>>k;

	int a[n];



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

		cin>>a[i];

	fill(dp,dp+n,INF);

	dp[0] = 0;

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



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

			if(j < n)

				dp[j] = min(dp[j] , dp[i] + abs(a[i]-a[j]));

	}



	cout<<dp[n-1]<<endl;

}
// Slower C++ solution:
#include <iostream>

#include <limits.h>

using namespace std;

int mod(int n)

{

	if(n>=0) return n;

	return -1*n;

}

int mini(int a, int b)

{

    if(a<b) return a;

    return b;

}

int cost3(int n, int h[], int k)

{

	int a[n],i;

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

		a[i] = INT_MAX;

	if(n==1)

		return 0;

	if(n==2)

		return mod(h[0]-h[1]);

	a[n-1]=0;

	a[n-2]=mod(h[n-1]-h[n-2]);

	for(i=n-3;i>=0;i--)

		for(int j = i+1;j<min(n,i+k+1);j++)

			a[i] = mini(a[i],mod(h[i]-h[j])+a[j]);

	return a[0];

}

 

int main()

{

	int n,k;

	cin >> n >> k;

	int i,h[n];

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

		cin >> h[i];

	cout << cost3(n,h,k);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.175199195209325x):
#include <cstdio>

#include <algorithm>

#include <vector>

using namespace std;

 

int n,dp[100005],a[100005],k; 

int main(){

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

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

		scanf("%d",&a[i]);

	}

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

		dp[i]=dp[i-1]+abs(a[i]-a[i-1]);

		for (int j=max(1,i-k);j<i;j++){

			dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j])); 

		}

	}

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

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){

	int num[100005],k,ans=0;

	int n;

	cin>>n;

	cin>>k;

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

	{

		cin>>num[i];

	}

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

	{

		if(num[i]>=k)

		{

			ans++; 

		}

	}

	cout<<ans;

	return 0; 

}

// Faster C++ solution for the same problem (measured speedup: 5.300352910519947x):
#include<stdio.h>

int main(){

	int i,m,k,t=0,cnt=0;

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

	int a[m];

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

		scanf("%d",&a[i]);

	}

		for(i=0;i<m-1;i++){

		if(a[i]>a[i+1]){

			t=a[i+1];

			a[i+1]=a[i];

			a[i]=t;

		}

	}

	if(a[m-1]<k){

		printf("0");

	}else{

	

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

		if(a[i]>=k)

		cnt++;

	}

	printf("%d",cnt);

}

	return 0;

}
// Slower C++ solution:
/*

the top of the losers

*/

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

#define sz(v)   ((int)(v).size())

#define  all(v)    ((v).begin()),((v).end())

#define  allr(v)    ((v).rbegin()),((v).rend())

#define   pb         push_back

#define   mp         make_pair

#define    Lcm(a,b)  ((a*b)/(__gcd(a,b)))

#define    X            real()

#define    Y            imag()

#define    clr(v,d)      memset( v, d ,sizeof(v))

#define   angle(n)      atan2((n.imag()),(n.real()))

#define   vec(a,b)       ((b)-(a))

#define   length(a)      hypot( (a.imag()),(a.real()) )

#define   normalize(a)      (a)/(length(a))

#define    dp(a,b)          (((conj(a))*(b)).real())

#define    cp(a,b)          (((conj(a))*(b)).imag())

#define    lengthsqrt(a)       dp(a,a)

#define    rotate0( a,ang)    ((a)*exp( point(0,ang) ))

#define    rotateA(about,p,ang)   (rotate0(vec(about,p),ang)+about)

#define    lcm(a,b)                ((a*b)/(__gcd(a,b)))

#define    reflection0(m,v)         (conj((v)/(m))*(m))

#define     reflectionA(m,v,p0)     (conj( (vec(p0,v))/(vec(p0,m)) ) * (vec(p0,m)) ) + p0

#define     same(p1,p2)               ( dp(  vec(p1,p2),vec(p1,p2)) < eps )

#define     point                    complex<double>

#define     point        complex<double>

#define    cp(a,b)          (((conj(a))*(b)).imag())

#define    PI  acos(-1)

typedef  long long     ll ;

typedef  unsigned long long     ull ;

const double eps= (1e-9);

using namespace std;

using namespace __gnu_pbds;

int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}

int getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1;}

int setBit1(int num, int idx) {return num | (1<<idx);}

ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}

ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}

int countNumBit1(int mask) {int ret=0; while (mask) 	{mask &= (mask-1);++ret;	}return ret;}

void GO(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}





int main(){

      GO();

      int n,k;

      cin>>n>>k;

      int cnt=0;

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

        int no;

        cin>>no;

        if(no>=k)

            cnt++;

      }

      cout<<cnt<<endl;



}


// Faster C++ solution for the same problem (measured speedup: 5.314594721531583x):
#include <stdio.h>



int main()

{

    int n,k,ans=0;

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

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

    {

        int x;

        scanf("%d",&x);

        if(x>=k)ans++;

    }

    printf("%d\n", ans);

    return 0;

}
// Slower C++ solution:




#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

using namespace std;

using namespace __gnu_pbds;

 

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'

#define mset(d,val) memset(d,val,sizeof(d))

#define setp(x) cout<<fixed<<setprecision(x)

#define forn(i,a,b) for(int i=a;i<b;i++)

#define fore(i,a,b) for(int i=a;i<=b;i++)

#define pb push_back

#define mp make_pair

#define F first

#define S second

#define INF ll(1e18)

#define MOD 998244353

#define pqueue priority_queue

#define fbo find_by_order

#define ook order_of_key

typedef long long ll;

typedef pair<ll,ll> ii;

typedef vector<ll> vi;

typedef vector<ii> vii;

typedef long double ld;

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

 

#define MAXN 1000000007

 

 

int main() {

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

	ll k,x;

	cin>>k>>x;

	if ((k+x)>=100001) {

		for (ll i=x-k+1;i<=100000;i++) {

			cout<<i<<' ';

		}

	}

	else {

		if ((x-k)<=-100000) {

			for (ll i=-100000;i<x+k;i++) {

				cout<<i<<' ';

			}

		}

		else {

			for (ll i=x-k+1;i<x+k;i++) {

				cout<<i<<' ';

			}

		}

	}

}


// Faster C++ solution for the same problem (measured speedup: 5.285580722818439x):
////sfef

#include<stdio.h>

int main(){



int k,x,i,p,q,r;

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

p=(x-(k-1));

q=(x+(k-2));

r=(x+(k-1));

if(k==1)

{

    printf("%d",x);

}

else{

    for(i=p;i<=q;i++)    

    {

        printf("%d ",i);

    }

    printf("%d",r);

}



return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstring>

#include <algorithm>

using namespace std;



int arr[105];

int ans[105];

int main() {

  int n;

  cin >> n;

  string f;

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

    cin >> arr[i];

  }



  int r = n;

  int cntr = 1;

  while (r > 0){

    int flag = -1;

    for (int i = r; i >= 1; i--){

      if (arr[i] == i){

        flag = i;

        break;

      }

    }

    if (flag == -1){

      cout << "-1" << endl;

      return 0;

    }

    ans[cntr] = flag;

    cntr++;

    for (int i = flag; i < r; i++){

      arr[i] = arr[i+1];

    }

    r--;

  }



  for (int i = n; i >= 1; i--){

    cout << ans[i] << endl;

  }



}

// Faster C++ solution for the same problem (measured speedup: 5.320439796448381x):
#include<cstdio>



using namespace std;



int a[101];

int b[101];

int main(){

	int n;

	scanf("%d",&n);

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

		scanf("%d",&a[i]);

	for(int i=n;i;i--){

		int o=0;

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

			if(a[j]==j)o=j;

		if(o==0){

			printf("-1\n");

			return 0;

		}

		b[++b[0]]=o;

		for(int j=o;j<i;j++)

			a[j]=a[j+1];

	}

	for(int i=b[0];i;i--)

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

}