stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
/// 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;

}

// Faster C++ solution for the same problem (measured speedup: 5.317202382881821x):
#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"); 

	 

}
// Slower C++ solution:
#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:;

	}

}




// Faster C++ solution for the same problem (measured speedup: 5.143316034703362x):
#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"); 

	 

}
// Slower C++ solution:
#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");

}

// Faster C++ solution for the same problem (measured speedup: 5.112370851551762x):
#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"); 

	 

}
// Slower C++ solution:
#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");

}


// Faster C++ solution for the same problem (measured speedup: 5.181183821456005x):
#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"); 

	 

}
// Slower C++ solution:
#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");

}

// Faster C++ solution for the same problem (measured speedup: 5.1945194170607545x):
#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"); 

	 

}
// Slower C++ solution:
#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;

}


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

#include <vector>

#include <cmath>

#include <algorithm>

#include <iomanip>

#include <string>



using namespace std;



typedef long long ll;



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

#define ff first

#define ss second



int main() {

	drobucs;



	ll n;

	cin >> n;



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

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

		cin >> v[i].ff >> v[i].ss;

	}



	sort(v.begin(), v.end(), [](pair<ll, ll> d1, pair<ll, ll> d2) {

		if (d1.ss != d2.ss) {

			return d1.ss < d2.ss;

		}

		else {

			return d1.ff < d2.ff;

		}

	});



	ll sum = 0;

	for (auto t : v) {

		sum += t.ff;

		if (sum > t.ss) {

			cout << "No";

			return 0;

		}

	}

	cout << "Yes";

	return 0;

}
// Slower C++ solution:
#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;

}


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

#include <algorithm>

#include <vector>

using namespace std;

int main()

{

	int n;

	vector<pair<int, int>> a;

	cin >> n;

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

		cin >> b >> d;

		a.push_back({ b,d });

	}

	sort(a.begin(), a.end(), [](pair<int, int> t, pair<int, int> k) {return t.second < k.second ? true : t.second > k.second ? false :

		t.first < k.first ? true : false; });



	int h = 0;

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

		h += a[i].first;

		if (h > a[i].second) {

			cout << "No";

			return 0;

		}

	}

	cout << "Yes";

	return 0;

}
// Slower C++ solution:
#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;

}


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

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

using namespace std;

#define F first

#define S second

#define X real()

#define Y imag()

#define cross(a, b) ((conj(a) * (b)).Y)

#define dot(a, b) ((conj(a) * (b)).X)

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

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

#define EPS 1e-7

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

long long mod = 1e9;

const int N = 1e9;

typedef long long ll;

typedef unsigned long long ull;

typedef long double ld;

const double pi = acos(-1);

typedef complex <ll> point;

typedef tuple<int, int, int> line;

typedef vector<point> polygon;

ll n , x, y , ans;

vector<pair<ll,ll>> v;

int main()

{

    em3

    cin >> n;

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

    {

        cin >> x >> y;

        v.push_back({y , x});

    }

    sort(all(v));

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

    {

        if(ans + v[i].second <= v[i].first)

            ans += v[i].second;

        else

            return cout << "No" , 0;

    }

    cout << "Yes" ;





    return 0;

}
// Slower C++ solution:
#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;

}


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

using namespace std;

const int N = 2e5 + 5, mod = 1000003;

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

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

#define ll long long

int main()

{

    Hello

    ll n, sum = 0;

    vector<pair<ll, ll>>v;

    cin >> n;

    for(int i = 0, a, b; i < n; i++)

    {

        cin >> a >> b;

        v.push_back({b, a});

    }

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

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

    {

        sum += v[i].second;

        if( sum > v[i].first )

            return cout << "No", 0;

    }

    cout << "Yes";

    return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.639697630687982x):
//============================================================================

// Name        : competitive_programing.cpp

// Author      : .Data_Nerd.

// Description : problem solving training

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



#include <bits/stdc++.h>

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

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

#define MOD 1000000007

#define OO 0x3f3f3f3f

#define NIL -1

using namespace std;

typedef long long ll;

typedef long double ld;



int n;



vector <pair <int, int>> arr;



int main() {

    Data_Nerd



	scanf("%d", &n);



    arr.resize(n);



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

    	scanf("%d%d", &arr[i].second, &arr[i].first);



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



    ll time = 0;



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

    	time += arr[i].second;



    	if(time > arr[i].first)

    		return puts("No"), 0;

    }



    puts("Yes");



    return 0;

}
// Slower C++ solution:
#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;

}


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

#include <cstring>

#include <algorithm> 

#include <cmath> 

#include <cstdio> 

typedef long long ll;

#define size 500050

using namespace std;

int a[size];

struct node {

	int x,y;

}p[size];

bool cmp(node a,node b) {

	if(a.x==a.x) {

		return a.y<b.y;

	}

	return a.x<a.x;

}

int main()

{

	int n;

	cin >> n;

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

		cin >> p[i].x >> p[i].y;

	}

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

	

	int l=0;

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

		if(l+p[i].x > p[i].y) {

			cout<<"No"<<endl;

			return 0;

		}

		l += p[i].x;

	}

	cout<<"Yes"<<endl;

	

	return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.59673471008661x):
// In the name of God



#include <bits/stdc++.h>



using namespace std;



const int N = 2*(int)1e5+5;



pair<long long,long long> a[N];



int main() {

	ios_base::sync_with_stdio(false);

	cin.tie(0);

	int n;

	cin >> n;

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

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

	}

	sort(a, a+n);

	long long time = 0;

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

		if(time+a[i].second>a[i].first) {

			cout << "No";

			exit(0);

		}

		time += a[i].second;

	}

	cout << "Yes";

	return 0;

}
// Slower C++ solution:
#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;

}


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

#include <algorithm>

using namespace std;

int nums;



struct node{

	int l,r;

};



bool emp(node a,node b){

	return a.r<b.r;

}



int main(){

	scanf("%d",&nums);

	node arr[nums];

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

		cin>>arr[i].l>>arr[i].r;

	}

	sort(arr,arr+nums,emp);

	int alltimes=0;

	bool isOK=true;

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

		alltimes+=arr[i].l;

		//printf("%d\t%d\n",alltimes,arr[i].r);

		if(alltimes>arr[i].r){

			isOK=false;

			break;

		}

	}

	if(isOK){

		printf("Yes\n");

	}else{

		printf("No\n");

	}

	

	return 0;

}







//12 40---28/6=4

//16 40---24=3

/*



*/
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.6662281971734783x):
#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;

}
// Slower C++ solution:
#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;

}


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

#include <cstdio>

#include <algorithm>

#include <vector>

using namespace std;

int n;

pair<int,int> work[201000];

int main(){

	scanf("%d", &n);

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

		scanf("%d%d", &work[i].second, &work[i].first);

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

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

		if( i != 1 )

			work[i].second += work[i-1].second;

		if( work[i].second > work[i].first ){

			puts("No");

			return 0;

		}

	}

	puts("Yes");

	return 0;

}
// Slower C++ solution:
#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;

}


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

#include <iostream>

#include <queue>



using namespace std;



const int maxn = 2*1e5+5;

int n;

struct Node {

	int a,b;

	bool operator<(const Node &other) const {

        return b > other.b;

    }

}arr[maxn],mis;



priority_queue<Node> pq;



int main () {

	scanf("%d",&n);

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

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

		pq.push(arr[i]);

	}

	//i:当前时刻

	int i = 0;

	while(!pq.empty()) {

		mis = pq.top();

		pq.pop();

		//________________

		//cout << i << endl;

		//cout << mis.a << ' ' << mis.b << endl;

		//________________

		i += mis.a;

		if (i > mis.b) {

			printf("No\n");

			return 0;

		}

	}

	printf("Yes\n");

}