stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
//

/*==========================================================*/

/*    Template ver 2017-0720    |    Created by JollyBee    */

/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */

/*==========================================================*/

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef unsigned long long ull;

typedef vector<int> vi;

typedef pair<int,int> pii;

typedef pair<ll,ll> pll;

typedef vector<pii> vii;

const double EPS=(double)1e-9;

const double PI=(double)acos(-1.0);

#define fi first

#define se second

#define mp make_pair

#define pb push_back

#define pob pop_back

#define pf push_front

#define pof pop_front

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

#define REPP(i,l,r,c) for(int i=l;i<=r;i+=c)

#define REP(i,l,r) REPP(i,l,r,1)

#define FORD(i,n) for(int i=n-1;i>=0;i--)

#define REVV(i,l,r,c) for(int i=l;i>=r;i-=c)

#define REV(i,l,r) REVV(i,l,r,1)

//random

int irand(int lo, int hi){

    return (((double)rand())/(RAND_MAX+1.0)) * (hi-lo+1) + lo;

}

//ll to string

string toString(ll x) {

    stringstream ss;

    ss << x;

    return ss.str();

}

//string to ll

ll toNumber(string S) {

    ll ret;

    sscanf(S.c_str(),"%lld",&ret);

    return ret;

}

// std::fill(start, end, value);

// for(auto it: DS){}



const int INF=(int)2e9;

const ll MOD=(ll)1e9+7;

/*==========================================================*/

/*                     END OF TEMPLATE                      */

/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */

/*==========================================================*/



const int N = (int)2e5;



pii dat[N+5];



int main(){

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

    REP(i,1,n) scanf("%d %d", &dat[i].se, &dat[i].fi);

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

    //

    int timee = 0, res = 1;

    REP(i,1,n) if((timee += dat[i].se) > dat[i].fi){

        res = 0;

        break;

    }

    // print

    puts(res ? "Yes" : "No");

    return 0;

}


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

#include<algorithm>

using namespace std;

struct node{

	int a;

	int b;

}ss[200010];

int cmp(node x,node y){

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

	else return x.b<y.b;

}

int main(){

	int n;

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

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

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

		}

		sort(ss,ss+n,cmp);

		int flag=1;

		int sum=0;

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

			sum+=ss[i].a;

			if(sum>ss[i].b){

				flag=0;

				break;

			}

		}

		if(flag) printf("Yes\n");

		else printf("No\n");

	}

	return 0;

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

using namespace std;

#define N int(1e5 + 5)

#define MOD 1000003

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

typedef long long ll;

int main(){

    IO

    int n; cin >> n;

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

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

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

        v[i].second *= -1;

    }

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

    ll meh = 0;

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

        meh += v[i].second * -1;

        if(v[i].first < meh)

            return cout << "No", 0;

    }

    cout << "Yes";

}


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

#include<algorithm>

using namespace std;

struct node{

	int a;

	int b;

}ss[200010];

int cmp(node x,node y){

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

	else return x.b<y.b;

}

int main(){

	int n;

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

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

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

		}

		sort(ss,ss+n,cmp);

		int flag=1;

		int sum=0;

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

			sum+=ss[i].a;

			if(sum>ss[i].b){

				flag=0;

				break;

			}

		}

		if(flag) printf("Yes\n");

		else printf("No\n");

	}

	return 0;

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

#define pb push_back

#define fi first

#define sc second

#define inf	1000000000LL

#define MP make_pair

#define N 300005

#define MOD 1000000007 

#define orta ((a+b)/2)

using namespace std;

typedef long long int lint;

typedef pair<int,int> ii;



ii d[N];

int main()

{

	int n;

	cin >> n;



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

	{

		cin >> d[i].sc >> d[i].fi;

	}

	sort(d,d+n);

	int t=0;

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

	{

		t+=d[i].sc;

		if(t>d[i].fi)

		{

			cout << "No";

			return 0;

		}

	}

			cout << "Yes";

}

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

#include<algorithm>

using namespace std;

struct node{

	int a;

	int b;

}ss[200010];

int cmp(node x,node y){

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

	else return x.b<y.b;

}

int main(){

	int n;

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

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

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

		}

		sort(ss,ss+n,cmp);

		int flag=1;

		int sum=0;

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

			sum+=ss[i].a;

			if(sum>ss[i].b){

				flag=0;

				break;

			}

		}

		if(flag) printf("Yes\n");

		else printf("No\n");

	}

	return 0;

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

#include <bits/stdc++.h>

#define DEBUG true

#ifdef ONLINE_JUDGE

#undef DEBUG

#define DEBUG false

#endif 



using namespace std;



#define MAXN ((int)2e5+5)

#define MOD ((int)1e9 + 7)

#define INF ((int)1e9 + 9)

#define ll long long

#define _ << " " <<

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

#define TRACE(x) if(DEBUG) cerr << #x << " = " << x << endl;

#define TRACE2(x,y) if(DEBUG) cerr << #x << " = " << x << " | " << #y << " = " << y << endl;

#define pb push_back

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

#define endl "\n"

#define pii pair<int,int>

#define mid ((l+r)/2)



int n;

int a[MAXN];

int b[MAXN];

vector <pii> v;



int main()

{

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

	cin >> n;

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

	{

		cin >> a[i] >> b[i];		

		v.pb({b[i],a[i]});

	}	

	sort(all(v));



	int cur = 0;

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

	{

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

		{

			cur = cur + v[i].second;

		}

		else

		{

			cout << "No\n";

			return 0;

		}

	}

	cout << "Yes\n";



}

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

#include<algorithm>

using namespace std;

struct node{

	int a;

	int b;

}ss[200010];

int cmp(node x,node y){

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

	else return x.b<y.b;

}

int main(){

	int n;

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

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

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

		}

		sort(ss,ss+n,cmp);

		int flag=1;

		int sum=0;

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

			sum+=ss[i].a;

			if(sum>ss[i].b){

				flag=0;

				break;

			}

		}

		if(flag) printf("Yes\n");

		else printf("No\n");

	}

	return 0;

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

#include <cstdio>

#include <algorithm>

#include <queue>

using namespace std;

#define ll long long 

struct node{

	ll l,r;

	node(ll a,ll b){

		l=a;r=b;

	}

	friend bool operator<(const node &a,const node &b){

		return a.r>b.r;

	}

};

priority_queue<node> q;

ll n,t1,t2;

int main(){

	scanf("%lld",&n);

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

		scanf("%lld%lld",&t1,&t2);

		q.push(node(t1,t2));

	}

	ll sum=0;

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

		node e=q.top();

		q.pop();

		sum+=e.l;

		if(sum>e.r){

			printf("No");

			return 0;

		}

		//cout <<e.l<<" "<<e.r<<endl;

	}

	printf("Yes");

	return 0;

}

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

#include<algorithm>

using namespace std;

struct node{

	int a;

	int b;

}ss[200010];

int cmp(node x,node y){

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

	else return x.b<y.b;

}

int main(){

	int n;

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

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

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

		}

		sort(ss,ss+n,cmp);

		int flag=1;

		int sum=0;

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

			sum+=ss[i].a;

			if(sum>ss[i].b){

				flag=0;

				break;

			}

		}

		if(flag) printf("Yes\n");

		else printf("No\n");

	}

	return 0;

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

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

	{

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

			ans+=node[i].ai;	

		else

		{

			printf("No\n");

			return 0;

		}

	}

	printf("Yes\n");

	return 0;

}

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

#include<algorithm>

using namespace std;

struct node{

	int a;

	int b;

}ss[200010];

int cmp(node x,node y){

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

	else return x.b<y.b;

}

int main(){

	int n;

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

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

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

		}

		sort(ss,ss+n,cmp);

		int flag=1;

		int sum=0;

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

			sum+=ss[i].a;

			if(sum>ss[i].b){

				flag=0;

				break;

			}

		}

		if(flag) printf("Yes\n");

		else printf("No\n");

	}

	return 0;

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

#include <algorithm>

using namespace std;

typedef pair<int, int> P;

int main(void){

    int n, s = 0;

    P p[200000];

    cin >> n;

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

        int a, b;

        cin >> a >> b;

        p[i] = P(b, a);

    }

    sort(p, p+n);

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

        s += p[i].second;

        if(s > p[i].first){

            cout << "No" << endl;

            return 0;

        }

    }

    cout << "Yes" << endl;

}


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

#include <algorithm>

#include <vector>

using namespace std;

typedef pair<int, int> P;

int main(void){

    int n;

    vector<P> p;

    cin >> n;

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

        int a, b;

        cin >> a >> b;

        p.push_back(P(b, a));

    }

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

    int t = 0;

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

        t += p[i].second;

        if(t > p[i].first){

            puts("No");

            return 0;

        }

    }

    puts("Yes");

    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: 4.201641114651627x):
#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";

}
// 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: 4.221525020330307x):
#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;

}
// 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.2255613834703425x):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

const int maxd =2e5+10;

struct node

{

    int a,b;

    bool operator < (const node &other) const

    {

        if(b == other.b) return a < other.a;

        return b < other.b;

    }

}a[maxd];

int n;

int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    scanf("%d",&n);

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

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

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

    int now = 0;

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

    {

        if(now + a[i].a > a[i].b)

        {

            printf("No\n");

            return 0;

        }

        now += a[i].a;

    }

    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.218688572289886x):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

const int maxd =2e5+10;

struct node

{

    int a,b;

    bool operator < (const node &other) const

    {

        if(b == other.b) return a < other.a;

        return b < other.b;

    }

}a[maxd];

int n;

int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    scanf("%d",&n);

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

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

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

    int now = 0;

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

    {

        if(now + a[i].a > a[i].b)

        {

            printf("No\n");

            return 0;

        }

        now += a[i].a;

    }

    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.3007814597236225x):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

const int maxd =2e5+10;

struct node

{

    int a,b;

    bool operator < (const node &other) const

    {

        if(b == other.b) return a < other.a;

        return b < other.b;

    }

}a[maxd];

int n;

int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    scanf("%d",&n);

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

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

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

    int now = 0;

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

    {

        if(now + a[i].a > a[i].b)

        {

            printf("No\n");

            return 0;

        }

        now += a[i].a;

    }

    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.241671920649587x):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

const int maxd =2e5+10;

struct node

{

    int a,b;

    bool operator < (const node &other) const

    {

        if(b == other.b) return a < other.a;

        return b < other.b;

    }

}a[maxd];

int n;

int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    scanf("%d",&n);

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

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

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

    int now = 0;

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

    {

        if(now + a[i].a > a[i].b)

        {

            printf("No\n");

            return 0;

        }

        now += a[i].a;

    }

    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.282721336999347x):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

const int maxd =2e5+10;

struct node

{

    int a,b;

    bool operator < (const node &other) const

    {

        if(b == other.b) return a < other.a;

        return b < other.b;

    }

}a[maxd];

int n;

int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    scanf("%d",&n);

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

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

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

    int now = 0;

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

    {

        if(now + a[i].a > a[i].b)

        {

            printf("No\n");

            return 0;

        }

        now += a[i].a;

    }

    printf("Yes\n");

    return 0;

}