stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

#define IO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define S second

#define F first

#define ll long long

#define ld long double



using namespace std;



const int N = 2e5 + 5, mod = 1e9 + 7;



pair<ll, ll> p[N];



int main()

{

    ll n, sum = 0;

    bool valid = 1;

    cin>>n;

    for(int i = 0 ; i < n ; i++) cin>>p[i].S>>p[i].F;

    sort(p, p+n);

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

    {

        sum += p[i].S;

        if(sum > p[i].F) valid = 0;

    }

    valid ? cout<<"Yes" : cout<<"No";

}


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

#include<algorithm>

using namespace std; 

struct f{

	int a,b;

}a[1000000];

bool cmp(f d,f e)

{

	return d.b<e.b;

}

int main()

{

	 int n,i,p=0;

	 scanf("%d",&n);

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

	 {

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

	 }

	 sort(a,a+n,cmp);

	 long long int s=0;

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

	 {

	 	s+=a[i].a;

	 	if(s>a[i].b)

	 	{

		 p=1;

		 break;

		}

     }

     if(p==0)

     printf("Yes\n");

     else

     printf("No\n"); 

	 

}

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

#include <bits/stdc++.h>

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

typedef long long ll;

using namespace std;

ll n,t;

pair<ll,ll>arr[200005];

int main()

{

    abdelrahman001

    cin >> n;

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

        cin >> arr[i].second >> arr[i].first;

    sort(arr,arr+n);

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

    {

        t+=arr[i].second;

        if(t > arr[i].first)

            return cout << "No",0;

    }

    cout << "Yes";

    return 0;

}


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

#include<algorithm>

using namespace std; 

struct f{

	int a,b;

}a[1000000];

bool cmp(f d,f e)

{

	return d.b<e.b;

}

int main()

{

	 int n,i,p=0;

	 scanf("%d",&n);

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

	 {

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

	 }

	 sort(a,a+n,cmp);

	 long long int s=0;

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

	 {

	 	s+=a[i].a;

	 	if(s>a[i].b)

	 	{

		 p=1;

		 break;

		}

     }

     if(p==0)

     printf("Yes\n");

     else

     printf("No\n"); 

	 

}

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

#define endl '\n';

typedef long long ll;

const ll INF = 1e17 + 1;

const ll MAX = 2147483647;

const ll MOD = 1000003;



using namespace std;



ll min(ll x, ll y, ll z)

{

    return min(min(x, y), z);

}

ll max(ll x, ll y, ll z)

{

    return max(max(x, y), z);

}



ll min(ll x, ll y, ll z, ll o)

{

    return min(min(x, y, z), o);

}



ll _power(ll b, ll p)

{

    ll res = 1;

    while (p)

    {

        if (p % 2)

            res = (res * b) % MOD;

        b = (b * b) % MOD;

        p /= 2;

    }

    return res;

}



int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    int n;

    cin >> n;

    vector<int> duration(n + 1), end(n + 1);

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

        cin >> duration[i] >> end[i];

    vector<int> indices;

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

        indices.push_back(i);

    sort(indices.begin(), indices.end(), [&](int f, int s) {

        return end[f] < end[s];

    });



    int time = 0;

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

    {

        int d = duration[indices[i]];

        int e = end[indices[i]];

        time += d;

        if(time > e )

        {

            cout << "No\n";

            return 0;

        }

    }

    cout << "Yes\n";

    return 0;

}


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

#include<algorithm>

using namespace std; 

struct f{

	int a,b;

}a[1000000];

bool cmp(f d,f e)

{

	return d.b<e.b;

}

int main()

{

	 int n,i,p=0;

	 scanf("%d",&n);

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

	 {

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

	 }

	 sort(a,a+n,cmp);

	 long long int s=0;

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

	 {

	 	s+=a[i].a;

	 	if(s>a[i].b)

	 	{

		 p=1;

		 break;

		}

     }

     if(p==0)

     printf("Yes\n");

     else

     printf("No\n"); 

	 

}

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

using namespace std;

typedef long long ll;

typedef long double ld;



const int N = 2e5 + 5;

int arr[N];

int main() {

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    int n;

    cin >> n;

    vector<pair<ll, ll>> vec;

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

        ll a, b;

        cin >> a >> b;

        vec.push_back({b, a});

    }

    sort(vec.begin(), vec.end());

    ll curr = 0;

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

        curr += vec[i].second;

        if (curr > vec[i].first)

            return cout << "No", 0;

    }

    cout << "Yes";

    return 0;

}


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

#include<algorithm>

using namespace std; 

struct f{

	int a,b;

}a[1000000];

bool cmp(f d,f e)

{

	return d.b<e.b;

}

int main()

{

	 int n,i,p=0;

	 scanf("%d",&n);

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

	 {

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

	 }

	 sort(a,a+n,cmp);

	 long long int s=0;

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

	 {

	 	s+=a[i].a;

	 	if(s>a[i].b)

	 	{

		 p=1;

		 break;

		}

     }

     if(p==0)

     printf("Yes\n");

     else

     printf("No\n"); 

	 

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
/// Code By t_bone_289 (Tushar Singh)

/// An Immature Programmer.... I'm still developing !!

#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/trie_policy.hpp>

using namespace std;

using namespace __gnu_pbds;

#define pll pair<ll,ll>

#define fi first

#define se second

#define mp make_pair

#define pb emplace_back

#define endl '\n'

#define M 1000000007

#define error(x) cout << #x << " = " << x << endl;

#define pi 3.14159265358979323846

typedef long long ll;

typedef long double ld;

template <typename T>

void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}

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

ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}

ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}

ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}

bool cmp(pll a,pll b)

{

    if(a.se == b.se)

    {

        return (a.fi <= b.fi);

    }

    return (a.se<b.se);

}

int main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    ll n;

    cin>>n;

    vector<pll> v(n);

    for(auto &x:v)

    {

        cin>>x.fi>>x.se;

    }

    sort(v.begin(),v.end(),cmp);

    ll cs = 0;

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

    {

        cs += v[i].fi;

        if(cs > v[i].se)

        {

            cout<<"No";

            return 0;

        }

    }

    cout<<"Yes";

    return 0;

}

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

#include<algorithm>

using namespace std; 

struct f{

	int a,b;

}a[1000000];

bool cmp(f d,f e)

{

	return d.b<e.b;

}

int main()

{

	 int n,i,p=0;

	 scanf("%d",&n);

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

	 {

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

	 }

	 sort(a,a+n,cmp);

	 long long int s=0;

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

	 {

	 	s+=a[i].a;

	 	if(s>a[i].b)

	 	{

		 p=1;

		 break;

		}

     }

     if(p==0)

     printf("Yes\n");

     else

     printf("No\n"); 

	 

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#define mod 1000000007

#define PI acos(-1)

#include<time.h>

#include<stdio.h>

#include<string.h>

#include<math.h>

#include<map>

#include<queue>

#include<iostream>

#include<vector>

#include<algorithm>

using namespace std;

typedef long long ll;

const ll INF=0x7fffffffffffffff;

const int inf=0x7fffffff;

const int N=4e5+5;

clock_t start,finish;

void time_in(){start=clock();}

void time_out(){finish=clock();double tim=(double)(finish-start)/CLOCKS_PER_SEC;printf("Running time is %lf\n",tim);}

inline ll mul(ll a,ll b){ll s=0;while(b){if(b&1)s=(s+a)%mod;a=(a<<1)%mod;b>>=1;}return s%mod;}

inline ll pow_mul(ll a,ll b){ll s=1;while(b){if(b&1)s=mul(s,a);a=mul(a,a);b>>=1;}return s;}

inline ll poww(ll a,ll b){ll s=1;while(b){if(b&1)s=(s*a)%mod;a=(a*a)%mod;b>>=1;}return s%mod;}

inline bool read(int &ret){char c=getchar();int sgn;if(c==EOF)return 0;while(c!='-'&&(c<'0'||c>'9'))c=getchar();

	sgn=((c=='-')?-1:1);ret=((c=='-')?0:(c-'0'));while(c=getchar(),c>='0'&&c<='9')ret=ret*10+(c-'0');ret*=sgn;return 1;}

inline void write(int x){if(x>9)write(x/10);putchar(x%10+'0');}

int fact[10]={1,1,2,6,24,120,720,5040,40320,362880};

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

int t,cas;

int n,m,k;

struct xxx{ll x,y;}a[N];

bool cmp(xxx b,xxx c)

{

	return b.y<c.y;

}

int main()

{

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

	{

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

		{

			scanf("%lld%lld",&a[i].x,&a[i].y);

		}

		sort(a,a+n,cmp);

		ll ans=0;

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

		{

			ans+=a[i].x;

			if(ans>a[i].y){printf("No\n");goto e;}

		}

		printf("Yes\n");

		e:;

	}

}




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

#include<algorithm>

using namespace std; 

struct f{

	int a,b;

}a[1000000];

bool cmp(f d,f e)

{

	return d.b<e.b;

}

int main()

{

	 int n,i,p=0;

	 scanf("%d",&n);

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

	 {

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

	 }

	 sort(a,a+n,cmp);

	 long long int s=0;

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

	 {

	 	s+=a[i].a;

	 	if(s>a[i].b)

	 	{

		 p=1;

		 break;

		}

     }

     if(p==0)

     printf("Yes\n");

     else

     printf("No\n"); 

	 

}

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

using namespace std;

const int maxn=2e5+10;

const int mod=1e6+3;

typedef long long ll;

map<int,int>mp,mmp;

#define inf 0x3f3f3f3f

#define mem(a,b) memset(a,b,sizeof(a))

#define pi acos(-1.0)

void read(int &x)

{

	int f=1;x=0;

	char ch=getchar();

	while(ch<'0'||ch>'9')

	{

		if(ch=='-')f=-1;

		ch=getchar();

	}

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

	x*=f;

}

struct one

{

	int a,b;

}uu[maxn];

bool cmp(one x,one y)

{

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

	return x.b<y.b;

}

int main()

{

   int n,i,j;

   read(n);

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

   {

   	read(uu[i].a);read(uu[i].b);

   }

   sort(uu,uu+n,cmp);

   int tim=0;

   bool ok=1;

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

   {

   	tim+=uu[i].a;

   	if(tim>uu[i].b)

   	{

   		ok=0;break;

   	}

   }

   if(ok)puts("Yes");

   else puts("No");

}

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

#include<algorithm>

using namespace std; 

struct f{

	int a,b;

}a[1000000];

bool cmp(f d,f e)

{

	return d.b<e.b;

}

int main()

{

	 int n,i,p=0;

	 scanf("%d",&n);

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

	 {

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

	 }

	 sort(a,a+n,cmp);

	 long long int s=0;

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

	 {

	 	s+=a[i].a;

	 	if(s>a[i].b)

	 	{

		 p=1;

		 break;

		}

     }

     if(p==0)

     printf("Yes\n");

     else

     printf("No\n"); 

	 

}

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

#include <sstream>

#include <vector>

#include <cmath>

#include <cstdio>

#include <queue>

#include <set>

#include <map>

#include <cstdlib>

#include <cstring>

#include <algorithm>

using namespace std;

struct node{

int a,b,c;

}aa[200005];

int comp(const node t,node tt)

{

if(t.b==tt.b)

return t.c<tt.c;

else

return t.b<tt.b;





}

int main()

{

int n;

scanf("%d",&n);

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

{

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

aa[i].c=aa[i].b-aa[i].a;

}

sort(aa,aa+n,comp);

int sum=0;

int f=0;

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

{

sum+=aa[i].a;

//printf("%d %d",sum,aa[i].b);

if(sum>aa[i].b)

{f=1;

break;

}



}

if(f==0)

printf("Yes\n");

else

printf("No\n");

}


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

#include<algorithm>

using namespace std; 

struct f{

	int a,b;

}a[1000000];

bool cmp(f d,f e)

{

	return d.b<e.b;

}

int main()

{

	 int n,i,p=0;

	 scanf("%d",&n);

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

	 {

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

	 }

	 sort(a,a+n,cmp);

	 long long int s=0;

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

	 {

	 	s+=a[i].a;

	 	if(s>a[i].b)

	 	{

		 p=1;

		 break;

		}

     }

     if(p==0)

     printf("Yes\n");

     else

     printf("No\n"); 

	 

}

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

#include <bits/stdc++.h>

#define ll long long

#define ld long double

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

using namespace std;

const int N = 2e5 + 5, M = 2 * N + 5;





int main(){

    int n;

    scanf("%d", &n);

    vector<pair<int, int> > v;

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

        int x, y;

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

        v.emplace_back(y, -x);

    }

    sort(v.begin(), v.end());

    int nw = 0;

    for(auto p : v){

        int dead = p.first;

        int tim = -p.second;

        if(tim + nw > dead){

            puts("No");

            return 0;

        }

        nw += tim;

    }

    puts("Yes");

}

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

#include<algorithm>

using namespace std; 

struct f{

	int a,b;

}a[1000000];

bool cmp(f d,f e)

{

	return d.b<e.b;

}

int main()

{

	 int n,i,p=0;

	 scanf("%d",&n);

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

	 {

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

	 }

	 sort(a,a+n,cmp);

	 long long int s=0;

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

	 {

	 	s+=a[i].a;

	 	if(s>a[i].b)

	 	{

		 p=1;

		 break;

		}

     }

     if(p==0)

     printf("Yes\n");

     else

     printf("No\n"); 

	 

}

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



using namespace std;



int main() {

    ios::sync_with_stdio(false);

    cin.tie(NULL);



    int n, t=0;

    pair<int,int> v[200001];

    cin >> n;



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

        cin >> v[i].second >> v[i].first;

    }



    sort(v+1, v+1+n);



    bool ok = true;

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

        if (t+v[i].second > v[i].first) {

            ok = false;

            break;

        } else t += v[i].second;

    }



    if (ok) cout << "Yes" << endl;

    else cout << "No" << endl;

}


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

#include<cstdio>

#include<algorithm>

using namespace std;

int n;

const long long maxn = 1e6;

struct Node{

	int ai,bi;

}node[maxn];

bool cmp(Node a,Node b)

{

	if(a.bi == b.bi) return a.ai < b.ai;

	return a.bi < b.bi;

}

int main(void)

{

	scanf("%d",&n);

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

		scanf("%d %d",&node[i].ai,&node[i].bi);

	sort(node+1,node+1+n,cmp);

//	int ans = 0;

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

//	{

//		if((ans + node[i].ai) <= node[i].bi) ans += node[i].ai;

//		else{

//			puts("NO");

//			return 0;

//		}

//	}

//	puts("Yes");

	int t=0;

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

	{

		if(t+node[i].ai<=node[i].bi)

			t+=node[i].ai;	

		else

		{

			printf("No\n");

			return 0;

		}

	}

	printf("Yes\n");

	return 0;

}

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

#define ll long long

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

using namespace std;

const int N = 2e5+5, M=2e4+5, oo=0x3f3f3f3f;



ll n, t;

pair<ll, ll> p[N];



int main()

{

    cin >> n;

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

        cin >> p[i].second >> p[i].first;

    sort(p, p+n);

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

    {

        if(t + p[i].second > p[i].first)

            return cout << "No", 0;

        t+=p[i].second;

    }

    cout << "Yes";

    return 0 ;

}


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

#include<algorithm>

using namespace std;

struct work{

	long long u;

	long long l;

}a[200005];

bool cmp(work a,work b)

{

	return a.l<b.l;

}

int main()

{

	long long n,i,d,j;

	while(~scanf("%lld",&n))

	{int w=0;

	 long long sum=0;

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

	 {scanf("%lld%lld",&a[i].u,&a[i].l);

	 }

	 sort(a,a+n,cmp);

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

	 {sum+=a[i].u;

	  if(sum>a[i].l){w=1;break;}

	 }

	if(w==1)printf("No\n");

	else printf("Yes\n");

	}

}

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

using namespace std;

typedef long long ll;





void Egriiiiiiiii()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

}



int main()

{

     Egriiiiiiiii() ;



     int n ;

     cin>>n;

     vector<pair<int,int> >v(n);

     int a,b;

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

       cin>>a>>b;

       v[i].second=a;

       v[i].first=b ;

     }

     sort(v.begin(),v.end()) ;

     ll arr[n]={0} ; arr[0]=v[0].second ;

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

        arr[i]=arr[i-1]+v[i].second ;

     }

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

        a=v[i].first ;

        if(a<arr[i]){

            cout<<"No"<<"\n" ;

            return 0;

        }

     }

     cout<<"Yes\n" ;

     return 0;

}


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

#include<algorithm>

using namespace std;

struct work{

	long long u;

	long long l;

}a[200005];

bool cmp(work a,work b)

{

	return a.l<b.l;

}

int main()

{

	long long n,i,d,j;

	while(~scanf("%lld",&n))

	{int w=0;

	 long long sum=0;

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

	 {scanf("%lld%lld",&a[i].u,&a[i].l);

	 }

	 sort(a,a+n,cmp);

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

	 {sum+=a[i].u;

	  if(sum>a[i].l){w=1;break;}

	 }

	if(w==1)printf("No\n");

	else printf("Yes\n");

	}

}

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

#define debug1 cout<<"?"<<endl;

#define debug2 cout<<"?"<<i<<endl;

#define PII pair<int,int>

typedef long long ll;

const int maxn=2e5+9;

const double pi=acos(-1);

const int mod=1e9+7;

const int INF=1e9;

const double ep=1e-7;

using namespace std;

ll kpow(ll a,ll b)

{

	ll ans=1;

	while(b)

	{

		if(b&1)ans=(ans*a)%mod;

		a=(a*a)%mod;

		b>>=1;

	}

	return ans;

}

int main()

{

	ll n,i,a[maxn]={0},ans=0;

	scanf("%lld",&n);

	for(i=1;i<=n;i++)scanf("%lld",&a[i]);

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

	for(ll i=1;i<=n;i++)ans=(ans+(((a[i]*kpow(2,n-1))%mod*kpow(2,i-1))%mod*(n-i+2))%mod*kpow(2,n-i))%mod;

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

}

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

typedef long long ll;

const int maxn=2e5+9;

const int mod=1e9+7;

using namespace std;

ll kpow(ll a,ll b)

{

	ll ans=1;

	while(b)

	{

		if(b&1)ans=(ans*a)%mod;

		a=(a*a)%mod;

		b>>=1;

	}

	return ans;

}

int main()

{

	ll n,i,a[maxn],ans=0;

	scanf("%lld",&n);

	for(i=1;i<=n;i++)scanf("%lld",&a[i]);

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

	for(ll i=1;i<=n;i++)ans=(ans+(((a[i]*kpow(2,n-1))%mod*kpow(2,i-1))%mod*(n-i+2))%mod*kpow(2,n-i))%mod;

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

}

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

using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

const int INF = 1e9;

const ll LINF = 1e18;



/*

 <url:https://agc002.contest.atcoder.jp/tasks/agc002_c>

問題文============================================================

 N 本のロープがあります。 ロープは 1 から N まで番号が振られています。 ロープ i の長さは ai です。

 

 最初、1≤i≤N−1 について、ロープ i の右端とロープ i+1 の左端が結ばれています。

 高橋君は次の操作を N−1 回行い、すべての結び目をほどこうとしています。

 

 ひと繋がりのロープのうち、長さの総和が L 以上のものをひとつ選ぶ。

 選んだひと繋がりのロープに結び目があれば、結び目のうちどれかひとつをほどく。

 

 高橋君は結び目をほどく順番を工夫し、すべての結び目をほどくことができるでしょうか？

 可能か判定し、可能ならば結び目をほどく順番をひとつ求めてください。



=================================================================



解説=============================================================



 結び目を解く順番によらず、いずれ紐は二本が繋がった ai + a_i+1 := len の長さを扱わなくては行けなくなる

 逆にこの len が len >= L であれば、この二本が入ったグループが残されるように両端から紐を解いて行けば良いので

 

 possible か impossibleかどうかの判定は ai + a_i+1 >= L の判定でできる

 

================================================================

*/



struct sec{

    ll l,r,len;

    sec(){}

    sec(ll l,ll r,ll len):l(l),r(r),len(len){}

};

void solve(){

    int N,L; cin >> N >> L;

    vector<int> a(N);

    for(auto &in:a) cin >> in;

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

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

            cout << "Possible" << endl;

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

            for(int j = N - 1; j > i; j--) cout << j << endl;

            return;

        }

    }

    cout << "Impossible" << endl;

}

int main(void) {

	cin.tie(0); ios::sync_with_stdio(false);

    solve();

	return 0;

}


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

#include <stdlib.h>

#define MN 100000

int n,l,a[MN+5],b;

int main(){

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

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

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

	for(b=1;b<=n-1;b++)

		if(a[b]+a[b+1]>=l)break;

	if(b==n) puts("Impossible"),exit(0);

	puts("Possible");

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

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

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

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

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

}

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

#include<map>

#include<stack>

#include<queue>

#include<deque>

#include<cmath>

#include<cstdio>

#include<cctype>

#include<string>

#include<vector>

#include<cstdlib>

#include<cstring>

#include<sstream>

#include<iostream>

#include<algorithm>

#define MAXN 100000



using namespace std;

int a[MAXN+80];

int main()

{

	int i,j,n,L;

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

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

		scanf("%d",a+i);

	for(i=1;i<n&&a[i]+a[i+1]<L;i++);

	if(i==n)

	{

		printf("Impossible\n");

		return 0;

	}

	puts("Possible");

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

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

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

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

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

	return 0;

}

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

int n,l,s[100010];

int main(){

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

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

		scanf("%d",s+i);

	}

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

		if (s[i]+s[i-1]>=l){

			printf("Possible\n");

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

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

			}

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

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

			}

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

			return 0;

		}

	}

	printf("Impossible\n");

}

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

using namespace std;

using ll = long;

const ll N = 200010;

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

int main()

{

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

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

		scanf("%lld", a + i);

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

		if (a[i] + a[i + 1] >= k)

		{

			pos = i;

			break;

		}

	if (pos == 0)

		return puts("Impossible"), 0;

	puts("Possible");

	for (ll i = 1; i < pos; i++)

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

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

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

	printf("%lld", pos);

}

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

using namespace std;

using ll = long;

const ll N = 200010;

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

int main()

{

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

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

		scanf("%lld", a + i);

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

		if (a[i] + a[i + 1] >= k)

		{

			pos = i;

			break;

		}

	if (pos == 0)

		return puts("Impossible"), 0;

	puts("Possible");

	for (ll i = 1; i < pos; i++)

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

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

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

	printf("%lld", pos);

}

// Fastest known solution for this problem: