stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#pragma GCC optimize(2)



#include <iostream>

#include <cstdio>

#include <algorithm>



using namespace std;



const int maxn = 2e5 + 10;

const int inf = 0x3f3f3f;



typedef long long ll;



int n;



struct node

{

	int a, b;

};



node da[maxn];



int read()

{

	int x;

	scanf("%d", &x);

	return x;

}



bool cmp(node x, node y)

{

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

	else return x.a < y.a;

}



int main()

{

	n = read();

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

	{

		da[i].a = read();

		da[i].b = read();

	}

	

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

	/*

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

	{

		cout << da[i].a << " " << da[i].b << endl;

	}

	*/

	int time = 0;

	

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

	{

		if(time + da[i].a <= da[i].b)time += da[i].a;

		else 

		{

			cout << "No" << endl;

			return 0;

		}

	}

	cout << "Yes" << endl;

	return 0;

}

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

#include<string.h>

#include<algorithm>

using namespace std;

struct node{

    int x,y;

}a[200008];

bool cmp(node q,node p){

    if(q.y==p.y)

        return q.x<p.x;

    else

        return q.y<p.y;

}

int main(){

  int n;

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

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

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

    sort(a,a+n,cmp);

    int t=0,i;

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

        if(t+a[i].x<=a[i].y)

            t+=a[i].x;

        else

            break;

    }

    if(i==n){

        printf("Yes\n");

    }

    else

        printf("No\n");

  }

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

#include <vector>

#include <set>

#include <algorithm>

#include <queue>



using namespace std;



bool DEBUG = false;



bool cmp(pair<int,int> a, pair<int,int> b) {

    return a.second > b.second || a.second == b.second && a.first > b.first;

}



int main(){

    int n,a,b;

    priority_queue<pair<int,int>, vector<pair<int,int> >, bool(*)(pair<int,int>,pair<int,int>)> pq(cmp);

    cin >>n;

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

        cin >>a >>b;

        pq.push(make_pair(a,b));

    }

    

    int time = 0;

    bool success = true;

    while(!pq.empty()){

        pair<int,int> task = pq.top();

        pq.pop();

        

        if(DEBUG){

            cout <<"Time=" <<time <<endl;

            cout <<"Task=" <<task.first <<" " <<task.second <<endl;

        }

        

        if(task.second < time + task.first){

            success = false;

            break;

        }

        else{

            time += task.first;

        }

    }

    

    if(success) cout <<"Yes";

    else cout <<"No";

    cout <<endl;

}

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

#include<string.h>

#include<algorithm>

using namespace std;

struct node{

    int x,y;

}a[200008];

bool cmp(node q,node p){

    if(q.y==p.y)

        return q.x<p.x;

    else

        return q.y<p.y;

}

int main(){

  int n;

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

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

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

    sort(a,a+n,cmp);

    int t=0,i;

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

        if(t+a[i].x<=a[i].y)

            t+=a[i].x;

        else

            break;

    }

    if(i==n){

        printf("Yes\n");

    }

    else

        printf("No\n");

  }

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



using namespace std;



#define ll long long







int main()

{

    int n, last = 0;

    bool ok = 1;

    cin >> n;

    vector <pair <int, int>> b;

    vector <int> time(n);

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

        int x, y;

        cin >> x >> y;

        b.push_back({y, x});

    }



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



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

        time[i] = last + b[i].second;

        last = time[i];

        if (time[i] > b[i].first)

            ok = 0;

    }



    if (ok)

        cout << "Yes";

    else

        cout << "No";



    return 0;

}


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

#include<string.h>

#include<algorithm>

using namespace std;

struct node{

    int x,y;

}a[200008];

bool cmp(node q,node p){

    if(q.y==p.y)

        return q.x<p.x;

    else

        return q.y<p.y;

}

int main(){

  int n;

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

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

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

    sort(a,a+n,cmp);

    int t=0,i;

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

        if(t+a[i].x<=a[i].y)

            t+=a[i].x;

        else

            break;

    }

    if(i==n){

        printf("Yes\n");

    }

    else

        printf("No\n");

  }

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



using namespace std;

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

#define REP(i,a,b) REPP(i,a,b,1)

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

#define REV(i,a,b) REVV(i,a,b,1)

#define FOR(i,a) REP(i,0,(int)a-1)

#define FORD(i,a) REV(i,(int)a-1,0)

#define PB push_back

#define POB pop_back

#define FI first

#define SE second

#define MP make_pair

typedef long long ll;

typedef unsigned long long ull;

typedef pair < int , int > pii;

typedef vector < int > vi;

typedef vector < pii > vii;

typedef vector < ll > vl;

typedef pair < ll , ll > pll;



const double PI = acos(-1);

const double EPS = 1e-9;

const ll MOD = 1e9 + 7;

const int INF = 1e9;

	



ll addMod(ll a, ll b){

	if(a + b >= MOD) return a + b - MOD;

	return a + b;

}



ll mulMod(ll a, ll b){

	return (a*b)%MOD;

}



ll fast(ll a, ll b){

	if(b == 0) return 1;

	ll tmp = fast(a,b/2);

	tmp = mulMod(tmp,tmp);

	if(b%2 == 1) tmp = mulMod(tmp,a);

	return tmp;

}



ll GCD(ll a, ll b){

	if(a > b) return GCD(b,a);

	if(a == 0) return b;

	return GCD(b%a,a);

}



//////////////////////////////////////////////



const int N = 2e5;



struct datt{

	int ti, en;

}dat[N + 5];



int n;



bool cmp(datt a, datt b){

	return a.en < b.en;

}



bool solve(){

	sort(dat, dat+n, cmp);

	int now = 0;

	FOR(i,n){

		now += dat[i].ti;

		if(now > dat[i].en) return false;

	}

	return true;

}



int main(){

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

	cin >> n;

	FOR(i,n) cin >> dat[i].ti >> dat[i].en;

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

	else cout << "No" << endl;

	return 0;

}

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

#include<string.h>

#include<algorithm>

using namespace std;

struct node{

    int x,y;

}a[200008];

bool cmp(node q,node p){

    if(q.y==p.y)

        return q.x<p.x;

    else

        return q.y<p.y;

}

int main(){

  int n;

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

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

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

    sort(a,a+n,cmp);

    int t=0,i;

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

        if(t+a[i].x<=a[i].y)

            t+=a[i].x;

        else

            break;

    }

    if(i==n){

        printf("Yes\n");

    }

    else

        printf("No\n");

  }

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



using namespace std;

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

#define ll  long long

#define ull unsigned long long

#define mod (ll)(1000000007)

#define endl '\n'

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

#define pi double(acos(-1))

#define S second

#define F first

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

//  freopen("input.txt","r",stdin);

// freopen("output.txt","w",stdout);

ll fp(ll n , ll p )

{

    if(p==0)

        return 1 ;

    if(p==1)

        return n%mod ;

    ll res ;

    res = fp(n,p/2)%mod;

    res = (res*res)%mod ;

    if(p%2)

        res = (res*n)%mod ;

    return res;

}





int main()

{

    ENGZ;

    pair<ll,ll> arr[200005] ;

    ll n , a = 0 , b;

    cin>>n ;

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

    {

        cin>>arr[i].S >>arr[i].F ;

    }

    sort(arr,arr+n);

    bool f = 1 ;

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

    {

        a+=arr[i].S ;

        if(a>arr[i].F)

            f=0 ;

    }

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

    else cout<<"No" <<endl ;

}


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

#include<string.h>

#include<algorithm>

using namespace std;

struct node{

    int x,y;

}a[200008];

bool cmp(node q,node p){

    if(q.y==p.y)

        return q.x<p.x;

    else

        return q.y<p.y;

}

int main(){

  int n;

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

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

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

    sort(a,a+n,cmp);

    int t=0,i;

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

        if(t+a[i].x<=a[i].y)

            t+=a[i].x;

        else

            break;

    }

    if(i==n){

        printf("Yes\n");

    }

    else

        printf("No\n");

  }

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

#include<cmath>

#include<stdio.h>

#include <ctype.h>

#include<iomanip>

#include<algorithm>

#include<string>

#include<stack>

#include<set>

#include<map>

#include<deque> //<< fixed << setprecision()

#include<queue> //priority_queue

#include<vector>

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

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



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 inFile(t) freopen((t),"r",stdin)

#define outFile(t) freopen((t),"w",stdout)

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

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

#define EPS 1e-7

long long mod = 1e9 + 7;

const int N = 1e4 + 5;

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;





int main()

{

	map<ll, ll>mp;

	int n;

	cin >> n;

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

	{

		ll a, b;

		cin >> a >> b;

		mp[b] += a;

	}

	ll sum = 0;

	bool good = 1;

	for (auto i : mp)

	{

			sum += i.second;

		if (sum > i.first)

		{

			good = 0;

			break;

		}



	}

	if (good)

		cout << "Yes";

	else

		cout << "No";

}

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

#include<string.h>

#include<algorithm>

using namespace std;

struct node{

    int x,y;

}a[200008];

bool cmp(node q,node p){

    if(q.y==p.y)

        return q.x<p.x;

    else

        return q.y<p.y;

}

int main(){

  int n;

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

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

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

    sort(a,a+n,cmp);

    int t=0,i;

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

        if(t+a[i].x<=a[i].y)

            t+=a[i].x;

        else

            break;

    }

    if(i==n){

        printf("Yes\n");

    }

    else

        printf("No\n");

  }

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

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

#define ll long long

using namespace std;



bool cmp(const pair<int, int> &a, const pair<int, int> &b){

	if (a.second == b.second)

		return a.first < b.first;

	return a.second < b.second;

}



int main() {

	IO

	int n, a, b;

	cin >> n;

	pair <ll, ll> p[n];

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

		cin >> a >> b;

		p[i] = {a, b};

	}

	sort (p, p + n, cmp);

	ll sum = 0;

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

		sum += p[i].first;

		if (sum > p[i].second) return cout << "No", 0;

	}

	cout << "Yes";

	return 0;

}


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

#include<string.h>

#include<algorithm>

using namespace std;

struct node{

    int x,y;

}a[200008];

bool cmp(node q,node p){

    if(q.y==p.y)

        return q.x<p.x;

    else

        return q.y<p.y;

}

int main(){

  int n;

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

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

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

    sort(a,a+n,cmp);

    int t=0,i;

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

        if(t+a[i].x<=a[i].y)

            t+=a[i].x;

        else

            break;

    }

    if(i==n){

        printf("Yes\n");

    }

    else

        printf("No\n");

  }

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

using namespace std;

typedef long long int lint;

bool sortbysec(const pair<int,int> &a, 

              const pair<int,int> &b) 

{ 

    return (a.second < b.second); 

} 

int main(){

    lint n;

    cin >> n;

    vector < pair <int, int> > v;

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

        int temp1, temp2;

        cin >> temp1 >> temp2;

        v.push_back(make_pair(temp1,temp2));

    }

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

    lint cntr1 = 0;

    

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

        cntr1+=v[i].first;

        

        if(cntr1>v[i].second){

            cout << "No";

            return 0;

        }

    }

    cout << "Yes";

    return 0;

}


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

#include<string.h>

#include<algorithm>

using namespace std;

struct node{

    int x,y;

}a[200008];

bool cmp(node q,node p){

    if(q.y==p.y)

        return q.x<p.x;

    else

        return q.y<p.y;

}

int main(){

  int n;

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

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

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

    sort(a,a+n,cmp);

    int t=0,i;

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

        if(t+a[i].x<=a[i].y)

            t+=a[i].x;

        else

            break;

    }

    if(i==n){

        printf("Yes\n");

    }

    else

        printf("No\n");

  }

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

#include<algorithm>





using namespace std;

typedef struct 

{

    int finish;

    int must;

}work;

work A[300000];

bool paixu(const work& a, const work& b)

{

        return a.must < b.must;

};

int main()

{

    int n;

    cin>>n;



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

    {

        cin>>A[i].finish>>A[i].must;

    }

    sort(A,A+n,paixu);

    int last;

    last = A[n-1].must - A[n-1].finish;

    for(int i=n-2;i>=0;i--)

    {

        if(last < A[i].must)

            A[i].must = last;

        else

            last = A[i].must;

        last = last - A[i].finish;

    }

    if(last >= 0)

        cout<<"Yes";

    else

    {

            cout<<"No";

    }

    

    return 0;

}

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

#include <algorithm>

using namespace std;

struct node

{

	int s,e;

}a[200005];

bool cmp(node a,node b)

{

	return a.e<b.e;

}

int main()

{

	int n,m,i,j,k,s,t;

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

	{

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

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

		sort(a,a+n,cmp);

		m=0;

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

		{

			m+=a[i].s;

			if(m>a[i].e)

			{

				m=-1;

				break;

			}

		}

		if(m==-1) printf("No\n");

		else  printf("Yes\n");

	}

	return 0;

}
// Slower C++ solution:
#pragma GCC optimize(2)



#include <iostream>

#include <cstdio>

#include <algorithm>



using namespace std;



const int maxn = 2e5 + 10;

const int inf = 0x3f3f3f;



typedef long long ll;



int n;



struct node

{

	int a, b;

};



node da[maxn];



int read()

{

	int x;

	scanf("%d", &x);

	return x;

}



bool cmp(node x, node y)

{

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

	else return x.a < y.a;

}



int main()

{

	n = read();

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

	{

		da[i].a = read();

		da[i].b = read();

	}

	

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

	/*

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

	{

		cout << da[i].a << " " << da[i].b << endl;

	}

	*/

	int time = 0;

	

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

	{

		if(time + da[i].a <= da[i].b)time += da[i].a;

		else 

		{

			cout << "No" << endl;

			return 0;

		}

	}

	cout << "Yes" << endl;

	return 0;

}

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

#include <algorithm>

using namespace std;

struct node

{

	int s,e;

}a[200005];

bool cmp(node a,node b)

{

	return a.e<b.e;

}

int main()

{

	int n,m,i,j,k,s,t;

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

	{

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

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

		sort(a,a+n,cmp);

		m=0;

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

		{

			m+=a[i].s;

			if(m>a[i].e)

			{

				m=-1;

				break;

			}

		}

		if(m==-1) printf("No\n");

		else  printf("Yes\n");

	}

	return 0;

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

#include <vector>

#include <set>

#include <algorithm>

#include <queue>



using namespace std;



bool DEBUG = false;



bool cmp(pair<int,int> a, pair<int,int> b) {

    return a.second > b.second || a.second == b.second && a.first > b.first;

}



int main(){

    int n,a,b;

    priority_queue<pair<int,int>, vector<pair<int,int> >, bool(*)(pair<int,int>,pair<int,int>)> pq(cmp);

    cin >>n;

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

        cin >>a >>b;

        pq.push(make_pair(a,b));

    }

    

    int time = 0;

    bool success = true;

    while(!pq.empty()){

        pair<int,int> task = pq.top();

        pq.pop();

        

        if(DEBUG){

            cout <<"Time=" <<time <<endl;

            cout <<"Task=" <<task.first <<" " <<task.second <<endl;

        }

        

        if(task.second < time + task.first){

            success = false;

            break;

        }

        else{

            time += task.first;

        }

    }

    

    if(success) cout <<"Yes";

    else cout <<"No";

    cout <<endl;

}

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

#include <algorithm>

using namespace std;

struct node

{

	int s,e;

}a[200005];

bool cmp(node a,node b)

{

	return a.e<b.e;

}

int main()

{

	int n,m,i,j,k,s,t;

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

	{

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

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

		sort(a,a+n,cmp);

		m=0;

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

		{

			m+=a[i].s;

			if(m>a[i].e)

			{

				m=-1;

				break;

			}

		}

		if(m==-1) printf("No\n");

		else  printf("Yes\n");

	}

	return 0;

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



using namespace std;



#define ll long long







int main()

{

    int n, last = 0;

    bool ok = 1;

    cin >> n;

    vector <pair <int, int>> b;

    vector <int> time(n);

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

        int x, y;

        cin >> x >> y;

        b.push_back({y, x});

    }



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



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

        time[i] = last + b[i].second;

        last = time[i];

        if (time[i] > b[i].first)

            ok = 0;

    }



    if (ok)

        cout << "Yes";

    else

        cout << "No";



    return 0;

}


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

#include <algorithm>

using namespace std;

struct node

{

	int s,e;

}a[200005];

bool cmp(node a,node b)

{

	return a.e<b.e;

}

int main()

{

	int n,m,i,j,k,s,t;

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

	{

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

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

		sort(a,a+n,cmp);

		m=0;

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

		{

			m+=a[i].s;

			if(m>a[i].e)

			{

				m=-1;

				break;

			}

		}

		if(m==-1) printf("No\n");

		else  printf("Yes\n");

	}

	return 0;

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



using namespace std;

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

#define REP(i,a,b) REPP(i,a,b,1)

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

#define REV(i,a,b) REVV(i,a,b,1)

#define FOR(i,a) REP(i,0,(int)a-1)

#define FORD(i,a) REV(i,(int)a-1,0)

#define PB push_back

#define POB pop_back

#define FI first

#define SE second

#define MP make_pair

typedef long long ll;

typedef unsigned long long ull;

typedef pair < int , int > pii;

typedef vector < int > vi;

typedef vector < pii > vii;

typedef vector < ll > vl;

typedef pair < ll , ll > pll;



const double PI = acos(-1);

const double EPS = 1e-9;

const ll MOD = 1e9 + 7;

const int INF = 1e9;

	



ll addMod(ll a, ll b){

	if(a + b >= MOD) return a + b - MOD;

	return a + b;

}



ll mulMod(ll a, ll b){

	return (a*b)%MOD;

}



ll fast(ll a, ll b){

	if(b == 0) return 1;

	ll tmp = fast(a,b/2);

	tmp = mulMod(tmp,tmp);

	if(b%2 == 1) tmp = mulMod(tmp,a);

	return tmp;

}



ll GCD(ll a, ll b){

	if(a > b) return GCD(b,a);

	if(a == 0) return b;

	return GCD(b%a,a);

}



//////////////////////////////////////////////



const int N = 2e5;



struct datt{

	int ti, en;

}dat[N + 5];



int n;



bool cmp(datt a, datt b){

	return a.en < b.en;

}



bool solve(){

	sort(dat, dat+n, cmp);

	int now = 0;

	FOR(i,n){

		now += dat[i].ti;

		if(now > dat[i].en) return false;

	}

	return true;

}



int main(){

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

	cin >> n;

	FOR(i,n) cin >> dat[i].ti >> dat[i].en;

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

	else cout << "No" << endl;

	return 0;

}

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

#include <algorithm>

using namespace std;

struct node

{

	int s,e;

}a[200005];

bool cmp(node a,node b)

{

	return a.e<b.e;

}

int main()

{

	int n,m,i,j,k,s,t;

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

	{

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

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

		sort(a,a+n,cmp);

		m=0;

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

		{

			m+=a[i].s;

			if(m>a[i].e)

			{

				m=-1;

				break;

			}

		}

		if(m==-1) printf("No\n");

		else  printf("Yes\n");

	}

	return 0;

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



using namespace std;

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

#define ll  long long

#define ull unsigned long long

#define mod (ll)(1000000007)

#define endl '\n'

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

#define pi double(acos(-1))

#define S second

#define F first

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

//  freopen("input.txt","r",stdin);

// freopen("output.txt","w",stdout);

ll fp(ll n , ll p )

{

    if(p==0)

        return 1 ;

    if(p==1)

        return n%mod ;

    ll res ;

    res = fp(n,p/2)%mod;

    res = (res*res)%mod ;

    if(p%2)

        res = (res*n)%mod ;

    return res;

}





int main()

{

    ENGZ;

    pair<ll,ll> arr[200005] ;

    ll n , a = 0 , b;

    cin>>n ;

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

    {

        cin>>arr[i].S >>arr[i].F ;

    }

    sort(arr,arr+n);

    bool f = 1 ;

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

    {

        a+=arr[i].S ;

        if(a>arr[i].F)

            f=0 ;

    }

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

    else cout<<"No" <<endl ;

}


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

#include <algorithm>

using namespace std;

struct node

{

	int s,e;

}a[200005];

bool cmp(node a,node b)

{

	return a.e<b.e;

}

int main()

{

	int n,m,i,j,k,s,t;

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

	{

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

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

		sort(a,a+n,cmp);

		m=0;

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

		{

			m+=a[i].s;

			if(m>a[i].e)

			{

				m=-1;

				break;

			}

		}

		if(m==-1) printf("No\n");

		else  printf("Yes\n");

	}

	return 0;

}