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

#include <cstring>

#include <algorithm>

#include <string>

#include <cmath>

#include <stack>

#include <vector>

#include <map>

#include <set>

#include <queue>

#include <list>

#include <iostream>

#include <sstream>

#include <climits>

#include <cfloat>

#include <complex>



using namespace std;



typedef long long ll;



ll count_rooms_lesseq_than(ll newRoomNo)

{

	int t[10], d;

	for (d = 0; newRoomNo; ++d, newRoomNo /= 10)

		t[d] = newRoomNo % 10;

	for (int i = d-1; i > 0; --i)

	{

		if (t[i] == 4 || t[i] == 6)

		{

			--t[i];

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

				t[j] = 9;

			break;

		}

	}



	ll res = 0;

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

	{

		ll a = 1;

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

			a *= 8;

		res += (t[i] - (t[i] >= 6 ? 2 : t[i] >= 4 ? 1 : 0)) * a;

	}

	return res;

}

int main()

{

	int n;

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

	{

		ll l, u;

		l = 1;

		u = n * 10LL;

		while (l < u)

		{

			ll m = (l + u) / 2;

			ll t = count_rooms_lesseq_than(m);

			if (t < n)

				l = m + 1;

			else

				u = m;

		}

		printf("%lld\n", l);

	}



	return 0;

}

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



int main()

{

	int n;

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

	{

		int t[10], d;

		for (d = 0; n; ++d, n /= 8)

			t[d] = n % 8;

		for (int i = d-1; i >= 0; --i)

			printf("%d", t[i] >= 5 ? t[i]+2 : t[i] == 4 ? t[i]+1 : t[i]);

		printf("\n");

	}



	return 0;

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

#include <vector>

#include <algorithm>



void ToOctalNumber(int n){

	if(!n)return;

	ToOctalNumber(n >> 3);

	std::cout << ((n&7)<4?n&7:(n&7)==4?5:(n&7)+2);

}



int main(){

	int n;

	while(std::cin >> n, n){

		ToOctalNumber(n);

		std::cout << "\n";

	}

}

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



void ToOctalNumber(int n){

	if(n){

		ToOctalNumber(n >> 3);

		printf("%d",(n&7)<4?n&7:(n&7)==4?5:(n&7)+2);

	}

}



int main(){

	int n;

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

		ToOctalNumber(n);

		puts("");

	}

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

using namespace std;



const int t[8] = { 0, 1, 2, 3, 5, 7, 8, 9 };



/*void solve(int n){

    if(n >= 8)

        solve(n / 8);

    cout << table[n % 8] ;

}*/



long long int solve(int n){

	long long int s=0;

	for(int i=1 ; n >0; i *= 10 , n /= 8)

		s += (long long int)t[n%8]*i;

	return s;

}

int main(){

    int n;

    

    while( cin >> n , n ){

		cout << solve(n) << endl;

    }

    

}

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

int t[]={0,1,2,3,5,7,8,9};

void s(int n){if(n>7)s(n/8);printf("%d",t[n%8]);}

main(){for(int a;scanf("%d",&a),a;puts(""))s(a);}
// Slower C++ solution:
#include <stdio.h>

#include <string.h>

#include <set>

#include <queue>

#define N 100010

using namespace std;

int n,m,d[N];

int ne=0,h[N];struct edge{int to,w,x;}e[400010];

inline void ins(int s,int t,int w) {

	e[++ne].to=t;e[ne].w=w;e[ne].x=h[s];h[s]=ne;

}

struct stat {

	int n,d;

	stat(){}

	stat(int a,int b){n=a;d=b;}

	inline bool operator>(const stat& a) const {

		return d!=a.d?d>a.d:n<a.n;

	}

};

set<int> vis[N];

inline int dij(int s,int t) {

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

	stat u;int v,oo,nd;

	memset(d,33,sizeof(d));oo=*d;

	d[s]=0;q.push(stat(s,0));

	while(!q.empty()) {

		u=q.top();q.pop();

		if(u.d>d[u.n]) continue;

		for(int i=h[u.n];i;i=e[i].x) {

			v=e[i].to;nd=u.d+(vis[u.n].count(e[i].w)?0:1);

			if(nd<d[v]) {

				d[v]=nd;q.push(stat(v,nd));

				vis[v].clear();

			}

			if(nd==d[v]) vis[v].insert(e[i].w);

		}

	}

	return oo==d[t]?-1:d[t];

}

int main() {

	int a,b,c;

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

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

		scanf("%d%d%d",&a,&b,&c);

		ins(a,b,c);ins(b,a,c);

	}

	printf("%d",dij(1,n));

	return 0;

}

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

#include <iostream>

#include <algorithm>

#include <cstring>

#include <queue>

#define MN 301000

#define MM 1601000



typedef std::pair<int, int> P;

int h[MN], nxt[MM], to[MM], cost[MM], K = 0;

std::vector<P> v[101000];

int d[MN], n, m;

std::deque<int> q;



void ins(int u, int v, int c) {nxt[++K] = h[u]; h[u] = K; to[K] = v; cost[K] = c;}



int bfs()

{

	q.push_back(1);

	memset(d, 0x3f, sizeof(d)); d[1] = 0;

	while(!q.empty())

	{

		int u = q.front(); q.pop_front();

		for(int i = h[u]; i; i = nxt[i])

		{

			if(d[to[i]] > d[u] + cost[i])

			{

				d[to[i]] = d[u] + cost[i];

				if(cost[i]) q.push_back(to[i]);

				else q.push_front(to[i]);

			}

		}

	}

	if(d[n] > 1e9) return -1;

	return d[n];

}



int main()

{

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

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

	{

		int p, q, c; scanf("%d%d%d", &p, &q, &c);

		v[p].push_back(P(c, i));

		v[q].push_back(P(c, i));

		ins(p, n + i, 1); ins(n + i, p, 0);

		ins(q, n + i, 1); ins(n + i, q, 0);

	}

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

	{

		std::sort(v[i].begin(), v[i].end());

		int S = v[i].size();

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

		{

			if(v[i][j].first == v[i][j - 1].first)

			{

				ins(v[i][j].second + n, v[i][j - 1].second + n, 0);

				ins(v[i][j - 1].second + n, v[i][j].second + n, 0); 

			}

		}

	}

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

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

#include <string.h>

#include <set>

#include <queue>

#define N 100010

using namespace std;

int n,m,d[N];

int ne=0,h[N];struct edge{int to,w,x;}e[400010];

inline void ins(int s,int t,int w) {

	e[++ne].to=t;e[ne].w=w;e[ne].x=h[s];h[s]=ne;

}

struct stat {

	int n,d;

	stat(){}

	stat(int a,int b){n=a;d=b;}

	inline bool operator>(const stat& a) const {

		return d!=a.d?d>a.d:n<a.n;

	}

};

set<int> vis[N];

inline int dij(int s,int t) {

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

	stat u;int v,oo,nd;

	memset(d,33,sizeof(d));oo=*d;

	d[s]=0;q.push(stat(s,0));

	while(!q.empty()) {

		u=q.top();q.pop();

		if(u.d>d[u.n]) continue;

		for(int i=h[u.n];i;i=e[i].x) {

			v=e[i].to;nd=u.d+(vis[u.n].count(e[i].w)?0:1);

			if(nd<d[v]) {

				d[v]=nd;q.push(stat(v,nd));

				vis[v].clear();

			}

			if(nd==d[v]) vis[v].insert(e[i].w);

		}

	}

	return oo==d[t]?-1:d[t];

}

int main() {

	int a,b,c;

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

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

		scanf("%d%d%d",&a,&b,&c);

		ins(a,b,c);ins(b,a,c);

	}

	printf("%d",dij(1,n));

	return 0;

}

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

#include <algorithm>

#include <map>

#include <iostream> 

#include <queue>

#include <cstring>

#define INF 0x3f3f3f3f



const int MAXN = 1e5 + 1, MAXM = 2e5 + 1;



int n, m;



struct Edge { int ver, nxt, val; } edge[MAXM << 3];

int head[MAXN << 3], tot = 0;

inline void Ins(int x, int y, int z) { edge[++tot].ver = y, edge[tot].val = z, edge[tot].nxt = head[x], head[x] = tot; }



std :: map<std :: pair<int, int>, int> ex;

int cnt;

#define mp std :: make_pair

inline int id(int x, int num) { return ex[mp(x, num)] ? ex[mp(x, num)] : ex[mp(x, num)] = ++cnt; }



std :: deque<int> q; int d[MAXN << 3];

void BFS() {

    memset(d, 0x3f, sizeof d);

    d[1] = 0; q.push_front(1);

    while (q.size()) {

        int x = q.front(); q.pop_front();

        for (int i = head[x]; i; i = edge[i].nxt) {

            int y = edge[i].ver, z = edge[i].val;

            if (d[y] > d[x] + z) {

                d[y] = d[x] + z;

                !z ? q.push_front(y) : q.push_back(y);

            }

        }

    }

}



int main() {

    scanf("%d%d", &n, &m); cnt = n;

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

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

        int p = id(u, w), q = id(v, w);

        Ins(u, p, 1), Ins(q, v, 1), Ins(p, q, 0);

        Ins(p, u, 1), Ins(v, q, 1), Ins(q, p, 0);

    }

    BFS();

    printf("%d\n", d[n] == INF ? -1 : d[n] >> 1);

    return 0;

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

#include <iostream>

#include <algorithm>

#include <cstring>

#include <queue>

#define MN 301000

#define MM 1601000



typedef std::pair<int, int> P;

int h[MN], nxt[MM], to[MM], cost[MM], K = 0;

std::vector<P> v[101000];

int d[MN], n, m;

std::deque<int> q;



void ins(int u, int v, int c) {nxt[++K] = h[u]; h[u] = K; to[K] = v; cost[K] = c;}



int bfs()

{

	q.push_back(1);

	memset(d, 0x3f, sizeof(d)); d[1] = 0;

	while(!q.empty())

	{

		int u = q.front(); q.pop_front();

		for(int i = h[u]; i; i = nxt[i])

		{

			if(d[to[i]] > d[u] + cost[i])

			{

				d[to[i]] = d[u] + cost[i];

				if(cost[i]) q.push_back(to[i]);

				else q.push_front(to[i]);

			}

		}

	}

	if(d[n] > 1e9) return -1;

	return d[n];

}



int main()

{

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

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

	{

		int p, q, c; scanf("%d%d%d", &p, &q, &c);

		v[p].push_back(P(c, i));

		v[q].push_back(P(c, i));

		ins(p, n + i, 1); ins(n + i, p, 0);

		ins(q, n + i, 1); ins(n + i, q, 0);

	}

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

	{

		std::sort(v[i].begin(), v[i].end());

		int S = v[i].size();

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

		{

			if(v[i][j].first == v[i][j - 1].first)

			{

				ins(v[i][j].second + n, v[i][j - 1].second + n, 0);

				ins(v[i][j - 1].second + n, v[i][j].second + n, 0); 

			}

		}

	}

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

}

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

#include <algorithm>

#include <map>

#include <iostream> 

#include <queue>

#include <cstring>

#define INF 0x3f3f3f3f



const int MAXN = 1e5 + 1, MAXM = 2e5 + 1;



int n, m;



struct Edge { int ver, nxt, val; } edge[MAXM << 3];

int head[MAXN << 3], tot = 0;

inline void Ins(int x, int y, int z) { edge[++tot].ver = y, edge[tot].val = z, edge[tot].nxt = head[x], head[x] = tot; }



std :: map<std :: pair<int, int>, int> ex;

int cnt;

#define mp std :: make_pair

inline int id(int x, int num) { return ex[mp(x, num)] ? ex[mp(x, num)] : ex[mp(x, num)] = ++cnt; }



std :: deque<int> q; int d[MAXN << 3];

void BFS() {

    memset(d, 0x3f, sizeof d);

    d[1] = 0; q.push_front(1);

    while (q.size()) {

        int x = q.front(); q.pop_front();

        for (int i = head[x]; i; i = edge[i].nxt) {

            int y = edge[i].ver, z = edge[i].val;

            if (d[y] > d[x] + z) {

                d[y] = d[x] + z;

                !z ? q.push_front(y) : q.push_back(y);

            }

        }

    }

}



int main() {

    scanf("%d%d", &n, &m); cnt = n;

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

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

        int p = id(u, w), q = id(v, w);

        Ins(u, p, 1), Ins(q, v, 1), Ins(p, q, 0);

        Ins(p, u, 1), Ins(v, q, 1), Ins(q, p, 0);

    }

    BFS();

    printf("%d\n", d[n] == INF ? -1 : d[n] >> 1);

    return 0;

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

#include <cstring>

#include <queue>

#include <set>

#include <algorithm>

using namespace std;

const int inf=1<<29;

const int maxn=1e5+10;

const int maxm=2e5+10;

int n,m,cnt;

int head[maxn];

struct Edge

{

    int v,c,nx;

}edge[maxm<<1];

struct Node

{

    int v,w;

    bool operator <(const Node&n1) const {

        return w==n1.w?v<n1.v:w<n1.w;

    }

};

int dis[maxn];

bool vis[maxn];

set<int> col[maxn];



void _init() {

    cnt=0;

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

}



inline void add(int u,int v,int c) {

    edge[cnt].v=v; edge[cnt].c=c;

    edge[cnt].nx=head[u];

    head[u]=cnt++;

    edge[cnt].v=u; edge[cnt].c=c;

    edge[cnt].nx=head[v];

    head[v]=cnt++;

}



void bfs() {

    memset(vis,0,sizeof(vis));

    for (int i=1;i<=n;i++) col[i].clear();

    for (int i=1;i<=n;i++) dis[i]=inf;

    dis[1]=0;

    priority_queue<Node> q;

    q.push(Node{1,0});

    while (!q.empty()) {

        Node t=q.top(); q.pop();

        int u=t.v;

        if (vis[u]) continue;

        vis[u]=1;

        for (int i=head[u];i!=-1;i=edge[i].nx) {

            int v=edge[i].v;

            int w=col[u].count(edge[i].c)?0:1;

            if (dis[v]>dis[u]+w) {

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

                col[v].clear();

                col[v].insert(edge[i].c);

                q.push(Node{v,-dis[v]});

            } else if (dis[v]==dis[u]+w) {

                col[v].insert(edge[i].c);

            }

        }

    }

}



int main() {

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

        _init();

        int u,v,c;

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

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

            add(u,v,c);

        }

        bfs();

        printf("%d\n", dis[n]==inf?-1:dis[n]);

    }

    return 0;

}


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

#include <string.h>

#include <map>

#include <queue>

#define MN 100000

#define MM 200000

int n,m,vn;

int hd[MN*5+5],to[MM*6+5],nxt[MM*6+5],val[MM*6+5];

int dis[MN*5+5];

bool vis[MN*5+5];

void add(int u,int v,int w){

	static int rn=0;

	to[rn]=v,nxt[rn]=hd[u],val[rn]=w;

	hd[u]=rn++;

}

int gid(int u,int c){

	static std::map<int,int> tb[MN+5];

	if(tb[u].find(c)==tb[u].end()){

		tb[u][c]=(++vn);

		add(u,tb[u][c],1);

		add(tb[u][c],u,0);

	}

	return tb[u][c];

}

void bfs01(){

	static std::deque<int> q;

	memset(dis,0x3f,sizeof(dis));

	dis[1]=0; q.push_front(1);

	while(!q.empty()){

		int u=q.front(); q.pop_front();

		if(vis[u]) continue; vis[u]=true;

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

			if(vis[to[i]]) continue;

			if(dis[u]+val[i]<dis[to[i]]){

				dis[to[i]]=dis[u]+val[i];

				if(val[i]==0)

					q.push_front(to[i]);

				else

					q.push_back(to[i]);

			}

		}

	}

}

int main(){

	memset(hd,0xff,sizeof(hd));

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

	vn=n;

	for(int i=1,u,v,c;i<=m;i++){

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

		u=gid(u,c),v=gid(v,c);

		add(u,v,0),add(v,u,0);

	}

	bfs01();

	if(dis[n]==0x3f3f3f3f) puts("-1");

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

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

#include <cstdio>

#include <algorithm>

#include <queue>

#include <cstring>

#define N 100002

using namespace std;

struct node{

	int u,v,w;

}e[200002];

struct node1{

	int x,d;

	node1(int _x,int _d){

		x=_x,d=_d;

	}

};

vector<int> id[N];

int head[2000002],ver[2000002],nxt[2000002],edge[2000002],l;

int n,m,i,j,cnt[N],now[N],dis[2000002],num;

bool vis[2000002];

int read()

{

	char c=getchar();

	int w=0;

	while(c<'0'||c>'9') c=getchar();

	while(c<='9'&&c>='0'){

		w=w*10+c-'0';

		c=getchar();

	}

	return w;

}

int my_comp(const node &x,const node &y)

{

	return x.w<y.w;

}

void insert(int x,int y,double z)

{

	l++;

	ver[l]=y;

	edge[l]=z;

	nxt[l]=head[x];

	head[x]=l;

}

int bfs(int s)

{

	deque<node1> q;

	q.push_front(node1(s,0));

	vis[s]=1;

	while(!q.empty()){

		int x=q.front().x,d=q.front().d;

		q.pop_front();

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

			int y=ver[i];

			if(!vis[y]){

				vis[y]=1;

				if(y==num+n) return d+edge[i];

				if(edge[i]==1) q.push_back(node1(y,d+1));

				else q.push_front(node1(y,d));

			}

		}

	}

	return -1;

}

int main()

{

	n=read(),m=read();

	for(i=1;i<=m;i++) e[i].u=read(),e[i].v=read(),e[i].w=read();

	sort(e+1,e+m+1,my_comp);

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

		int u=e[i].u,v=e[i].v,w=e[i].w;

		if(now[u]!=w) cnt[u]++,now[u]=w,id[u].push_back(++num);

		if(now[v]!=w) cnt[v]++,now[v]=w,id[v].push_back(++num);

		insert(id[u][cnt[u]-1],id[v][cnt[v]-1],0);

		insert(id[v][cnt[v]-1],id[u][cnt[u]-1],0);

	}

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

		for(j=0;j<cnt[i];j++){

			insert(num+i,id[i][j],1);

			insert(id[i][j],num+i,1);

		}

	}

	int ans=bfs(num+1);

	if(ans==-1) cout<<ans<<endl;

	else cout<<ans/2<<endl;

	return 0;

}


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

using namespace std;

int n,m,num,dis[500010],Link[500010],t=0;

bool vis[500010];

map < pair< int,int >,int> mp;

struct dsa

{

	int v,nex,w;

}e[1200010];

void Insert(int xx,int yy,int zz) 

{

	e[++t].nex=Link[xx];e[t].v=yy;e[t].w=zz;Link[xx]=t;

	e[++t].nex=Link[yy];e[t].v=xx;e[t].w=zz;Link[yy]=t;

}

void Dijkstra()

{

	priority_queue < pair<int,int> > q;

	memset(dis,10,sizeof(dis));

	dis[1]=0;

	q.push(make_pair(0,1));

	while (q.size()) {

		int x=q.top().second;

		q.pop();

		if (vis[x]) continue;

		vis[x]=true;

		for (int i=Link[x];i;i=e[i].nex) 

		  if (dis[x]+e[i].w<dis[e[i].v]) {

		  	  dis[e[i].v]=dis[x]+e[i].w;

		  	  q.push(make_pair(-dis[e[i].v],e[i].v));

		  }

	}

}

int main()

{

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

	num=n;

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

		int xx,yy,zz;

		scanf("%d%d%d",&xx,&yy,&zz);

		if (mp.find(make_pair(xx,zz))==mp.end()) mp[make_pair(xx,zz)]=++num;

		if (mp.find(make_pair(yy,zz))==mp.end()) mp[make_pair(yy,zz)]=++num;

		Insert(mp[make_pair(xx,zz)],mp[make_pair(yy,zz)],0);

		Insert(mp[make_pair(xx,zz)],xx,1);

		Insert(mp[make_pair(yy,zz)],yy,1);

	}

	Dijkstra();

	if (dis[n]==dis[0]) cout<<"-1"<<endl;else cout<<dis[n]/2;

	return 0;

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

using namespace std;

int main(){

	int n , cont = 0;

	cin >> n;

	int arreglo[n];

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

		cin >> arreglo[i];

	}

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

		bool cuenta = true;

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

			if(arreglo[j] > arreglo[i]){

			   cuenta = false;

			}

		}

		if(cuenta) cont++;

	}

	cout << cont << endl;

	return 0;

}

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

#include <cmath>

using namespace std;

const int N=205;

int n;

int a[N];

int ans,chk;

int main()

{

	scanf("%d",&n);

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

	{

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

		chk=1;

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

			chk&=(a[j]<=a[i]);

		ans+=chk;

	}

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

	return 0;

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

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

#define foro(i,a,b) for(int i=int(a); i >= int(b); i--)

#define prnt(a) cout << a << endl



typedef long long int ll;



using namespace std;



int main() {

	int n; cin >> n;

	

	int h[n];

	fore(i,0,n) cin >> h[i];

	

	int ans = 0;

	fore(i,0,n) {

		bool s = true;

		

		fore(j,0,i) if (h[j] > h[i]) {

				s = false;

				break;

			}

		

		if (s == true) ans++;

	}

	

	prnt(ans);



	return 0;

}


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

#include <cmath>

using namespace std;

const int N=205;

int n;

int a[N];

int ans,chk;

int main()

{

	scanf("%d",&n);

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

	{

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

		chk=1;

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

			chk&=(a[j]<=a[i]);

		ans+=chk;

	}

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

	return 0;

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

#include<algorithm>

#include<iostream>

typedef long long LL;

using namespace std;

int main()

{

	int n,ans,h[200];

	cin>>n;ans=n;

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

	cin>>h[i];

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

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

	{

		if(h[j]>h[i])

		{

			ans--;break;

		}

	}

	cout<<ans;

}


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

#include <cmath>

using namespace std;

const int N=205;

int n;

int a[N];

int ans,chk;

int main()

{

	scanf("%d",&n);

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

	{

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

		chk=1;

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

			chk&=(a[j]<=a[i]);

		ans+=chk;

	}

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

	return 0;

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

#include <iostream>

#include <algorithm>

#include <cstring>

#include <map>

#include <vector>

using namespace std;

typedef long long LL;



struct node{

	LL a,b;

}s[200005];

bool cmp(node x,node y){

	if(x.a == 0 && y.a == 0) return x.b < y.b;

	return y.a * (x.b + 1) < x.a * (y.b + 1);

}



LL dp[200005][35];



int main(){

	LL n,T,st,ans = 0;

	cin >> n >> T;

	for(LL i = 1;i <= n;i ++) cin >> s[i].a >> s[i].b;

	st = n + 1; sort(s + 1,s + 1 + n,cmp);

	for(LL i = n;i >= 1;i --) if(s[i].a == 0) st = i;

	

	for(LL i = 0;i <= 31;i ++) dp[0][i] = T + 1;

	dp[0][0] = 0;

	for(LL i = 1;i < st;i ++){

		dp[i][0] = dp[i - 1][0];

		for(LL j = 1;j <= 31;j ++){

			dp[i][j] = min(dp[i - 1][j],(1 + dp[i - 1][j - 1]) * (1 + s[i].a) + s[i].b);

			dp[i][j] = min(dp[i][j],T + 1);

		}

	}

	for(LL j = 0;j <= 31;j ++){

		LL tt = dp[st - 1][j];

		if(tt > T) continue;

		ans = max(ans,j);

		for(LL k = st;k <= n;k ++){

			if(tt + s[k].b + 1 > T) break;

			ans = max(ans,(k - st + j + 1));

			tt += (s[k].b + 1);

		}

	}

	cout << ans << endl;

	return 0;

}

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

#include<cstring>

#include<algorithm>

#define For(i,A,B) for(i=(A);i<=(B);++i)

using namespace std;

typedef long long ll;

const int N=200050;

struct node{

    int a,b;

}a[N];

int b[N],f[35];

ll s[N];

inline bool cmp(const node &a,const node &b){return (ll)a.a*(b.b+1)>(ll)b.a*(a.b+1);}

inline void chkmin(int &a,int b){if(b<a)a=b;}

inline void chkmax(int &a,int b){if(b>a)a=b;}

int main(){

    int n,t,n1=0,n2=0,i,j,k=0,x,y,ans=0;

    ll tp;

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

    For(i,1,n){

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

        if(x){a[++n1].a=x;a[n1].b=y;}

        else b[++n2]=y;

    }

    sort(a+1,a+n1+1,cmp);

    sort(b+1,b+n2+1);

    For(i,1,n2)s[i]=s[i-1]+b[i]+1ll;

    memset(f,0x3f,sizeof(f));

    f[0]=0;

    For(i,1,n1){

        for(j=k;j>=0;--j)if((tp=(ll)(a[i].a+1)*(f[j]+1)+a[i].b)<=(ll)t)chkmin(f[j+1],tp);

        if(f[k+1]<=t)++k;

    }

    For(i,0,k)chkmax(ans,i+upper_bound(s+1,s+n2+1,t-f[i])-s-1);

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

    return 0;

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

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

#define per(i,a,b) for(int i=(a);i>=(b);i--)

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

#define fi first

#define se second

#define pb push_back

#define mp make_pair

using namespace std;

typedef pair<int,int> pii;

typedef vector<int> vi;

typedef long long ll;



const int N=100005;

vi A,B[10],p,q,res;

int n,K;



vi rev(vi a){

	vi b(n+1,0);

	rep(i,1,n)b[a[i]]=i;

	return b;

}



vi mul(vi a,vi b){

	vi c(n+1,0);

	rep(i,1,n)c[i]=a[b[i]];

	return c;

}



vi power(vi a,int p){

	vi res(n+1,0);

	rep(i,1,n)res[i]=i;

	for(;p;p>>=1,a=mul(a,a))

		if(p&1)res=mul(res,a);

	return res;

}



int main(){

	cin>>n>>K;

	p.resize(n+1,0);

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

	q.resize(n+1,0);

	rep(i,1,n)cin>>q[i];

	A=power(mul(q,mul(rev(p),mul(rev(q),p))),(K-1)/6);

	if(K%6==4)A=mul(A,q);

	if(K%6==5||K%6==0)A=mul(A,mul(q,rev(p)));

	B[1]=p;

	B[2]=q;

	B[3]=mul(q,rev(p));

	B[4]=rev(p);

	B[5]=rev(q);

	B[6]=mul(rev(q),p);

	res=mul(A,mul(B[(K-1)%6+1],rev(A)));

	rep(i,1,n)printf("%d ",res[i]);

	puts("");

	return 0;

}

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

using namespace std;

#define N 1000700

int n,k,ct,p[N],q[N],rp[N],rq[N],s[N],rs[N],vis[N],st[N],as[N],s1[N];

int main()

{

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

	for(int i=1;i<=n;i++)scanf("%d",&p[i]);

	for(int i=1;i<=n;i++)scanf("%d",&q[i]);

	if(k==1){for(int i=1;i<=n;i++)printf("%d ",p[i]);return 0;}

	if(k<=6)

	{

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

		{

			for(int j=1;j<=n;j++)s[p[j]]=q[j],p[j]=q[j];

			for(int j=1;j<=n;j++)q[j]=s[j];

		}

		for(int i=1;i<=n;i++)printf("%d ",q[i]);return 0;

	}

	for(int i=1;i<=n;i++)rp[p[i]]=i,rq[q[i]]=i;

	for(int i=1;i<=n;i++)s1[i]=rp[q[p[rq[i]]]];

	for(int i=3;i<=(k-1)%6+7;i++)

	{

		for(int j=1;j<=n;j++)s[p[j]]=q[j],p[j]=q[j];

		for(int j=1;j<=n;j++)q[j]=s[j];

	}

	for(int i=1;i<=n;i++)if(!vis[i])

	{

		ct=0;st[ct=1]=i;vis[i]=1;

		for(int j=s1[i];j!=i;j=s1[j])st[++ct]=j,vis[j]=1;

		for(int j=1;j<=ct;j++)as[st[j]]=st[(j-2+(k-1)/6)%ct+1];

	}

	for(int i=1;i<=n;i++)rs[as[i]]=i;

	for(int i=1;i<=n;i++)printf("%d ",rs[q[as[i]]]);

}//