stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>



#define endl '\n'



using namespace std;



int main() {

  ios_base::sync_with_stdio(false);

  cin.tie(0);



  int p, q, r;

  cin >> p >> q >> r;

  cout << min(p + q, min(p + r, r + q)) << endl;



  return 0;

}


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

int s[5];

int main ()

{

    int p,q,r;

    scanf("%d%d%d",&p,&q,&r);

    s[1]=p+q;

    s[2]=p+r;

    s[3]=q+r;

    int minn=500;

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

    {

        if (s[i]<minn)

            minn=s[i];

    }

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

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



using namespace std;



int main()

{



    int p=0;

    int q=0;

    int r=0;

    int v=0;

    int b=0;

    int m=0;

    int l=0;

    cin>>p;

    cin>>q;

    cin>>r;

    if((p==q)&&(p==r)){

    l=p+q;

    goto me;

}

else if(((p==q)&&(p!=r))&&p>r){



    l=p+r;

    goto me;

}

else if(((p==q)&&(p!=r))&&p<r){

    l=p+q;

    goto me;

}

else if(((p==r)&&(p!=q))&&p>q){

    l=p+q;

    goto me;

}

else if(((p==r)&&(p!=q))&&p<q){

    l=p+r;

    goto me;

}

else if(((r==q)&&(r!=p))&&r>p){

l=p+r;

    goto me;

}

else if(((r==q)&&(r!=p))&&r<p){

   l=r+q;

    goto me;

    }







        else if(p<q&&p<r){

            m=p;

         }



         else if(q<p&&q<r){

            m=q;

         }



          else if(r<p&&r<q){

            m=r;

         }

        if((p<q&&p>r)||(p<r&&p>q)){



            b=p;

         }

         else if((q<p&&q>r) || (q<r&&q>p)){

            b=q;

         }

         else if((r<q&&r>p) || (r<p&&r>q)){

            b=r;

         }







l=m+b;

me:

cout << l;

    return 0;

}


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

int s[5];

int main ()

{

    int p,q,r;

    scanf("%d%d%d",&p,&q,&r);

    s[1]=p+q;

    s[2]=p+r;

    s[3]=q+r;

    int minn=500;

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

    {

        if (s[i]<minn)

            minn=s[i];

    }

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

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

#include<math.h>

#include<bits/stdc++.h>

#include<string.h>

#include<algorithm>

using namespace std;

int a[5];

int main()

{

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

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

    sort(a+1,a+4);

    printf("%d\n",a[1]+a[2]);

    return 0;

}


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

int s[5];

int main ()

{

    int p,q,r;

    scanf("%d%d%d",&p,&q,&r);

    s[1]=p+q;

    s[2]=p+r;

    s[3]=q+r;

    int minn=500;

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

    {

        if (s[i]<minn)

            minn=s[i];

    }

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

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



#define endl '\n'



using namespace std;



int main() {

  ios_base::sync_with_stdio(false);

  cin.tie(0);



  int p, q, r;

  cin >> p >> q >> r;

  cout << min(p + q, min(p + r, r + q)) << endl;



  return 0;

}


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

#include<string.h>

using namespace std;

int a[5];

int main()

{

    int temp;

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

    {

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

    }

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

    {

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

        {

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

            {

                temp=a[i];

                a[i]=a[j];

                a[j]=temp;

            }

        }

    }

    printf("%d",a[0]+a[1]);

    return 0;

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



using namespace std;



int main()

{



    int p=0;

    int q=0;

    int r=0;

    int v=0;

    int b=0;

    int m=0;

    int l=0;

    cin>>p;

    cin>>q;

    cin>>r;

    if((p==q)&&(p==r)){

    l=p+q;

    goto me;

}

else if(((p==q)&&(p!=r))&&p>r){



    l=p+r;

    goto me;

}

else if(((p==q)&&(p!=r))&&p<r){

    l=p+q;

    goto me;

}

else if(((p==r)&&(p!=q))&&p>q){

    l=p+q;

    goto me;

}

else if(((p==r)&&(p!=q))&&p<q){

    l=p+r;

    goto me;

}

else if(((r==q)&&(r!=p))&&r>p){

l=p+r;

    goto me;

}

else if(((r==q)&&(r!=p))&&r<p){

   l=r+q;

    goto me;

    }







        else if(p<q&&p<r){

            m=p;

         }



         else if(q<p&&q<r){

            m=q;

         }



          else if(r<p&&r<q){

            m=r;

         }

        if((p<q&&p>r)||(p<r&&p>q)){



            b=p;

         }

         else if((q<p&&q>r) || (q<r&&q>p)){

            b=q;

         }

         else if((r<q&&r>p) || (r<p&&r>q)){

            b=r;

         }







l=m+b;

me:

cout << l;

    return 0;

}


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

#include<string.h>

using namespace std;

int a[5];

int main()

{

    int temp;

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

    {

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

    }

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

    {

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

        {

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

            {

                temp=a[i];

                a[i]=a[j];

                a[j]=temp;

            }

        }

    }

    printf("%d",a[0]+a[1]);

    return 0;

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

#include<math.h>

#include<bits/stdc++.h>

#include<string.h>

#include<algorithm>

using namespace std;

int a[5];

int main()

{

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

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

    sort(a+1,a+4);

    printf("%d\n",a[1]+a[2]);

    return 0;

}


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

#include<string.h>

using namespace std;

int a[5];

int main()

{

    int temp;

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

    {

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

    }

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

    {

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

        {

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

            {

                temp=a[i];

                a[i]=a[j];

                a[j]=temp;

            }

        }

    }

    printf("%d",a[0]+a[1]);

    return 0;

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



#define endl '\n'



using namespace std;



int main() {

  ios_base::sync_with_stdio(false);

  cin.tie(0);



  int p, q, r;

  cin >> p >> q >> r;

  cout << min(p + q, min(p + r, r + q)) << endl;



  return 0;

}


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

#include<algorithm>

#include<string.h>

using namespace std;

int a[20];

int b[20];

int ans=0;

int vis[25];

void dfs(int sum,int deep)

{

    if(deep==2)

    {

                b[++ans]=sum;

                return;



    }

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

    {

        if(vis[i]==0)

        {

            vis[i]=1;

        dfs(sum+a[i],deep+1);

        vis[i]=0;

        }



    }

}

int main()

{

    ans=0;

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

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

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

        dfs(0,0);

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

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

    return 0;

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



using namespace std;



int main()

{



    int p=0;

    int q=0;

    int r=0;

    int v=0;

    int b=0;

    int m=0;

    int l=0;

    cin>>p;

    cin>>q;

    cin>>r;

    if((p==q)&&(p==r)){

    l=p+q;

    goto me;

}

else if(((p==q)&&(p!=r))&&p>r){



    l=p+r;

    goto me;

}

else if(((p==q)&&(p!=r))&&p<r){

    l=p+q;

    goto me;

}

else if(((p==r)&&(p!=q))&&p>q){

    l=p+q;

    goto me;

}

else if(((p==r)&&(p!=q))&&p<q){

    l=p+r;

    goto me;

}

else if(((r==q)&&(r!=p))&&r>p){

l=p+r;

    goto me;

}

else if(((r==q)&&(r!=p))&&r<p){

   l=r+q;

    goto me;

    }







        else if(p<q&&p<r){

            m=p;

         }



         else if(q<p&&q<r){

            m=q;

         }



          else if(r<p&&r<q){

            m=r;

         }

        if((p<q&&p>r)||(p<r&&p>q)){



            b=p;

         }

         else if((q<p&&q>r) || (q<r&&q>p)){

            b=q;

         }

         else if((r<q&&r>p) || (r<p&&r>q)){

            b=r;

         }







l=m+b;

me:

cout << l;

    return 0;

}


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

#include<algorithm>

#include<string.h>

using namespace std;

int a[20];

int b[20];

int ans=0;

int vis[25];

void dfs(int sum,int deep)

{

    if(deep==2)

    {

                b[++ans]=sum;

                return;



    }

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

    {

        if(vis[i]==0)

        {

            vis[i]=1;

        dfs(sum+a[i],deep+1);

        vis[i]=0;

        }



    }

}

int main()

{

    ans=0;

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

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

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

        dfs(0,0);

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

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

    return 0;

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

#include<math.h>

#include<bits/stdc++.h>

#include<string.h>

#include<algorithm>

using namespace std;

int a[5];

int main()

{

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

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

    sort(a+1,a+4);

    printf("%d\n",a[1]+a[2]);

    return 0;

}


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

#include<algorithm>

#include<string.h>

using namespace std;

int a[20];

int b[20];

int ans=0;

int vis[25];

void dfs(int sum,int deep)

{

    if(deep==2)

    {

                b[++ans]=sum;

                return;



    }

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

    {

        if(vis[i]==0)

        {

            vis[i]=1;

        dfs(sum+a[i],deep+1);

        vis[i]=0;

        }



    }

}

int main()

{

    ans=0;

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

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

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

        dfs(0,0);

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

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

    return 0;

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

using namespace std;

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

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

#define N 500005

#define inf 666666666

int in[N],pos[N],p[N],ans[N],tot,n,k;

priority_queue <int> q;

int head[N],to[N<<1],nxt[N<<1],cnt;

void add(int u,int v)

{

	cnt++;

	to[cnt]=v;

	nxt[cnt]=head[u];

	head[u]=cnt;

}

#define ls id<<1

#define rs id<<1|1

int t[N<<2];

void change(int id,int l,int r,int p,int d)

{

	if(l==r) {

		t[id]=d;

		return;

	}

	int mid=(l+r)>>1;

	if(p<=mid) change(ls,l,mid,p,d);

	else change(rs,mid+1,r,p,d);

	t[id]=min(t[ls],t[rs]);

}

int query(int id,int L,int R,int l,int r)

{

	if(t[id]>=N) return inf;

	if(l==L&&r==R) return t[id];

	int Mid=(L+R)>>1;

	if(r<=Mid) return query(ls,L,Mid,l,r);

	else if(l>Mid) return query(rs,Mid+1,R,l,r);

	else return min(query(ls,L,Mid,l,Mid),query(rs,Mid+1,R,Mid+1,r));

}

int main()

{

	int tmp;

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

	rep(i,1,n) 

		scanf("%d",&tmp),p[tmp]=i;

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

	dep(i,n,1) {

		int pos=query(1,1,n,p[i],min(n,p[i]+k-1));

		if(pos!=inf) {

			add(p[i],p[pos]);

			in[p[pos]]++;

		}

		pos=query(1,1,n,max(1,p[i]-k+1),p[i]);

		if(pos!=inf) {

			add(p[i],p[pos]);

			in[p[pos]]++;

		}

		change(1,1,n,p[i],i);

	}

	rep(i,1,n) if(!in[i]) q.push(-i);

	while(!q.empty()) {

		int now=-q.top();

		ans[now]=++tot;

		q.pop();

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

			int v=to[i];

			--in[v];

			if(!in[v]) q.push(-v);

		}

	}

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

	return 0;

}

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

using namespace std;

const int maxn=5e5+5;

const int INF=1e7+5;

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

int n,k;

int A[maxn],ans[maxn],ind[maxn];

int tot;

int h[maxn],last[maxn<<1],to[maxn<<1];

int st[maxn<<2];

void build(int x,int l,int r)

{

	st[x]=INF;

	if(l==r) return;

	int mid=(l+r)>>1;

	build(x<<1,l,mid),build(x<<1|1,mid+1,r);

} 

void pushup(int x)

{

	st[x]=min(st[x<<1],st[x<<1|1]);

}

void update(int x,int l,int r,int id,int k)

{

	if(l==r){

		st[x]=k;

		return;

	}

	int mid=(l+r)>>1;

	if(id<=mid) update(x<<1,l,mid,id,k);

	else update(x<<1|1,mid+1,r,id,k);

	pushup(x);

}

int query(int x,int l,int r,int ql,int qr)

{

	if(r<ql||l>qr) return INF;

	if(l>=ql&&r<=qr) return st[x];

	int mid=(l+r)>>1;

	return min(query(x<<1,l,mid,ql,qr),query(x<<1|1,mid+1,r,ql,qr));

}

void add(int x,int y)

{

	to[++tot]=y;last[tot]=h[x];h[x]=tot;++ind[y];

}

int main()

{

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

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

		int a=0;

		scanf("%d",&a);

		A[a]=i;

	}

	build(1,1,n);

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

		int l=query(1,1,n,A[i],A[i]+k-1),r=query(1,1,n,A[i]-k+1,A[i]);

		if(l!=INF) add(A[i],A[l]);

		if(r!=INF) add(A[i],A[r]);

		update(1,1,n,A[i],i);

	}

	for(int i=1;i<=n;++i) if(!ind[i]) q.push(i);

	int cnt=0;

	while(q.size()){

		int u=q.top();

		q.pop();

		ans[u]=++cnt; 

		for(int i=h[u];i;i=last[i]){

			int v=to[i];

			if(!--ind[v]) q.push(v);

		}

	}

	for(int i=1;i<=n;++i) printf("%d\n",ans[i]);

	return 0;

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

using namespace std;



const int maxn=5e5+10;



void read(int &x)

{

	char c=getchar(); x=0;

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

	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();

}



int n,k,p[maxn],q[maxn],deg[maxn];

int tote,FIR[maxn],TO[maxn<<1],NEXT[maxn<<1];

priority_queue<int> pq;



namespace SegTree{

	int mn[maxn<<2];

#define lc (nd<<1)

#define rc (nd<<1|1)

#define mid ((s+t)>>1)



	void init()

	{

		memset(mn,0x3f3f3f3f,sizeof(mn));

	}



	void update(int nd,int s,int t,int id,int val)

	{

		if (s==t) {mn[nd]=val; return;}

		if (id<=mid) update(lc,s,mid,id,val);

		else update(rc,mid+1,t,id,val);

		mn[nd]=min(mn[lc],mn[rc]);

	}



	int query(int nd,int s,int t,int l,int r)

	{

		if (l<=s&&t<=r) return mn[nd];

		int Ans=0x7fffffff;

		if (l<=mid) Ans=min(Ans,query(lc,s,mid,l,r));

		if (r> mid) Ans=min(Ans,query(rc,mid+1,t,l,r));

		return Ans;

	}

}



void addedge(int u,int v)

{

	TO[++tote]=v;

	NEXT[tote]=FIR[u];

	FIR[u]=tote;

	deg[v]++;

}



int main()

{

	int i,x;

	read(n); read(k);

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

		read(p[i]),q[p[i]]=i;

	SegTree::init();

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

	{

		x=SegTree::query(1,1,n,q[i]-k+1,q[i]);

		if (x<=n) addedge(q[x],q[i]);

		x=SegTree::query(1,1,n,q[i],q[i]+k-1);

		if (x<=n) addedge(q[x],q[i]);

		SegTree::update(1,1,n,q[i],i);

	}

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

		if (!deg[i]) pq.push(i);

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

	{

		int u=p[i]=pq.top(); pq.pop();

		for (int p=FIR[u];p;p=NEXT[p])

			if (!(--deg[TO[p]])) pq.push(TO[p]);

	}

	for (i=1;i<=n;i++) q[p[i]]=i;

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

}


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

using namespace std;

#define N 2000010

int mn[N],d[N],h[N],v[N*2],nxt[N*2],ec,ans[N],ct,n,k,a[N],p[N];

void add(int x,int y){v[++ec]=y;nxt[ec]=h[x];h[x]=ec;}

void bd(int o,int l,int r){

	mn[o]=1e9;

	if(l==r)return;

	int md=(l+r)/2;

	bd(o*2,l,md);

	bd(o*2+1,md+1,r);

}

void mod(int o,int l,int r,int x,int y){

	if(l==r){

		mn[o]=y;

		return;

	}

	int md=(l+r)/2;

	if(x<=md)mod(o*2,l,md,x,y);

	else mod(o*2+1,md+1,r,x,y);

	mn[o]=min(mn[o*2],mn[o*2+1]);	

}

int q(int o,int l,int r,int x,int y){

	if(r<x||y<l)return 1e9;

	if(x<=l&&r<=y)return mn[o];

	int md=(l+r)/2;

	return min(q(o*2,l,md,x,y),q(o*2+1,md+1,r,x,y));

}

priority_queue<int>qu;

void tp(){

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

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

			d[v[j]]++;

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

		if(!d[i])qu.push(i);

	while(!qu.empty()){

		int x=qu.top();

		qu.pop();

		ans[++ct]=x;

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

			d[v[i]]--;

			if(!d[v[i]])qu.push(v[i]);

		}

	}

}

int main(){

	cin>>n>>k;

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

		int x;

		scanf("%d",&x);

		a[x]=i;

	}

	reverse(a+1,a+n+1);

	bd(1,1,n);

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

		int x=q(1,1,n,max(1,a[i]-k+1),a[i]);

		if(x>0&&x<=n)add(a[i],a[x]);

		x=q(1,1,n,a[i],min(n,a[i]+k-1));

		if(x>0&&x<=n)add(a[i],a[x]);

		mod(1,1,n,a[i],i);

	}

	tp();

	reverse(ans+1,ans+n+1);

	for(int i=1;i<=n;i++)p[ans[i]]=i;

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

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

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

#include<vector>

using namespace std;

vector<int>v[200001];

int arr[200001];

int main()

{

	int n,m;

	cin>>n>>m;

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

	{

		int a,b;

		cin>>a>>b;

		v[a].push_back(b);

		v[b].push_back(a);

		if(a==n)

		{

			arr[b]=1;

		}

		else if(b==n)

		{

			arr[a]=1;

		}

	}

	for(int i=0;i<v[1].size();i++)

	{

		if(arr[v[1][i]]==1)

		{

			cout<<"POSSIBLE";

			return 0;

		}

	}

				cout<<"IMPOSSIBLE";



	return 0;

}

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

using namespace std;

#define LL long long

#define MAX 0X3f3f3f3f

#define maxn 200000+10

int vis[200006];

map<int,int>mmp;

int main()

{

    int n,m;

    cin>>n>>m;

    //1-n是否路径只有2

    string s2="IMPOSSIBLE";

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

    {

        int a,b;

        cin>>a>>b;

        if(a==1)

        {

            if(vis[b])

            {

                s2="POSSIBLE";

            }

            vis[b]=1;

        }

        if(b==n)

        {

            if(vis[a])

            {

                s2="POSSIBLE";

            }

            vis[a]=1;

        }

    }

    cout<<s2<<endl;

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

    {



    }

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

using namespace std;



typedef long long ll;

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

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

template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}

template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}

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

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





int nextInt() { int x; scanf("%d", &x); return x;}



const int MAX_N = 200000 + 10;

int e[MAX_N];



int main2() {

  int N = nextInt();

  int M = nextInt();

  memset(e, 0, sizeof(e));

  REP(_, M) {

    int a = nextInt() - 1;

    int b = nextInt() - 1;

    if (a == 0) { e[b] |= 1; }

    if (a == N-1) { e[b] |= 2; }

    if (b == 0) { e[a] |= 1; }

    if (b == N-1) { e[a] |= 2; }

  }



  bool possible = false;

  REP(i, N) if (e[i] == 3) possible = true;

  cout << (possible ? "POSSIBLE" : "IMPOSSIBLE") << endl;

  return 0;

}



int main() {

  for (;!cin.eof();cin>>ws) main2();

  return 0;

}




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

using namespace std;



typedef long long ll;

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

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

#define CLR(t,v) memset(t,(v),sizeof(t))

template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}

template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}

template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}

template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}



int nextInt() { int x; scanf("%d", &x); return x;}



const int MAX_N = 212345;

bool canA[MAX_N];

bool canB[MAX_N];



int main2() {

  CLR(canA, 0);

  CLR(canB, 0);

  int N = nextInt();

  int M = nextInt();

  REP(i, M) {

    int a = nextInt();

    int b = nextInt();

    if (a > b) swap(a, b);



    if (a == 1) canA[b] = true;

    if (b == N) canB[a] = true;

  }

  bool ok = false;

  for (int i = 1; i <= N; i++) if (canA[i] && canB[i]) ok = true;

  cout << (ok ? "POSSIBLE" : "IMPOSSIBLE") << endl;

  return 0;

}



int main() {

  for (;!cin.eof();cin>>ws)

    main2();

  return 0;

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

#include <cstdio>

#include <cmath>

using namespace std;

int a[100005];

int main()

{

	int n,m,a,b;

	int x[200005]={0};

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

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

	{

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

		if(a==1)

		{

			x[b]++;

		}

		else if(b==1)

		{

			x[a]++;

		}

		if(a==n)

		{

			x[b]++;

		}

		else if(b==n)

		{

			x[a]++;

		}

	}

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

	{

		if(x[i]>1)

		{

			printf("POSSIBLE\n");

			return 0;

		}

	}

	printf("IMPOSSIBLE\n");

	return 0;

 } 

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

using namespace std;

const int maxn=200010;

int a1[maxn],a2[maxn];

int n,m;

int main(){

	cin>>n>>m;

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

		int x,y;

		cin>>x>>y;

		if(x==1) a1[y]=1;

		if(y==n) a2[x]=1;

	}

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

		if(a1[i]&&a2[i]){

			cout<<"POSSIBLE"<<endl;

			return 0;

		}

	}

	cout<<"IMPOSSIBLE"<<endl;

	return 0;

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



#include <vector>



#include <queue>



using namespace std;



const int N = 1000 * 1000 * 1000 + 7;

vector<int> adj[200005];

int dis[200005];

queue<int> q;

int main()

{

	int n, m;

	cin >> n;

	cin >> m;

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

	{

		int x, y;

		cin >> x;

		cin >> y;

		adj[x].push_back(y);

		adj[y].push_back(x);

	}

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

	{

		dis[i] = N;

	}

	dis[1] = 0;

	q.push(1);

	while(q.size())

	{

		int v = q.front();

		q.pop();

		for(int i = 0; i < adj[v].size(); i ++)

		{

			if(dis[adj[v][i]] == N)

			{

				dis[adj[v][i]] = dis[v] + 1;

				q.push(adj[v][i]);

			}

		}

	}

	if(dis[n] == 2)

	{

		cout << "POSSIBLE";

	}

	else

	{

		cout << "IMPOSSIBLE";

	}

	return 0;

}

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

#include<queue>

#include<algorithm>

#include<cstring>

using namespace std;

const int N=2e5;

int head[N+5];

struct mode

{

	int v,nxt;

}edge[2*N+5];

int d[N+5];

int vis[N+5];

priority_queue<pair<int,int> > q;

int cnt=1;



void add(int u,int v)

{

	edge[cnt].v=v;

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

	head[u]=cnt++;

}



void dijkstra()

{

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

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

	d[1]=0;

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

	while(!q.empty())

	{

		int x=q.top().second;

		q.pop();

		if(vis[x])

			continue;

		vis[x]=1;

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

		{

			int y=edge[i].v;

			if(d[y]>d[x]+1)

			{

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

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

			}

		}

	}

}



int main()

{

	ios::sync_with_stdio(false);

	int n,m;

	cin>>n>>m;

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

	{

		int u,v;

		cin>>u>>v;

		add(u,v);

	}

	dijkstra();

	//cout<<d[n]<<endl;

	if(d[n]<=2)

		cout<<"POSSIBLE"<<endl;

	else

		cout<<"IMPOSSIBLE"<<endl;

	return 0;

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

#include <cstdio>

#include <cmath>

using namespace std;

int a[100005];

int main()

{

	int n,m,a,b;

	int x[200005]={0};

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

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

	{

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

		if(a==1)

		{

			x[b]++;

		}

		else if(b==1)

		{

			x[a]++;

		}

		if(a==n)

		{

			x[b]++;

		}

		else if(b==n)

		{

			x[a]++;

		}

	}

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

	{

		if(x[i]>1)

		{

			printf("POSSIBLE\n");

			return 0;

		}

	}

	printf("IMPOSSIBLE\n");

	return 0;

 } 

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

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<cmath>

#include<algorithm>

#include<set>

//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector

//#include<bits/stdc++.h>

#define ll long long

using namespace std;



int main()

{

	ios::sync_with_stdio(false);

	set<int> s1,s2;

	int n,m,a,b;

	cin>>n>>m;

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

		cin>>a>>b;

		if(a==1){

			s1.insert(b);

		}

		if(b==1) s1.insert(a);

		if(a==n) s2.insert(b);

		if(b==n) s2.insert(a);

 	}

 	int f=0;

 	for(set<int>::iterator it=s1.begin() ;it!=s1.end();it++)

    {

        if(s2.find(*it)!=s2.end()){

			cout<<"POSSIBLE"<<endl;

			f=1;

			break;

        }

    }

 	if(f==0){

		cout<<"IMPOSSIBLE"<<endl;

 	}



return 0;

}