stablegradients/pie-gem5-pairs huggingface dataset:
// 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.284246111411177x):
#include<bits/stdc++.h>



#define SORT(v) sort(v.begin(),v.end())

#define si(n) scanf("%d",&n)

#define sii(n,m) scanf("%d %d",&n,&m)

#define sl(n) scanf("%lld",&n)

#define sll(n,m) scanf("%lld %lld",&n,&m)

#define ss(cad) scanf("%s",cad)

#define PB push_back

#define fst first

#define scn second

#define DBG(x) cerr << #x << " = " << (x) << endl; 

#define M 1000000007

#define N_MAX 100010



using namespace std;



typedef long long ll;

typedef vector<int> vi;

typedef vector<bool> vb;

typedef vector<ll> vl;

typedef pair<int,int> pi;

typedef vector<pi> vp;



int main()

{

	int n;

	si(n);

	vp vec(n);

	ll fin = 0;

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

		sii(vec[i].scn, vec[i].fst);



	SORT(vec);

	bool sw = 1;

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

	{

		fin += vec[i].scn;

		if(fin > vec[i].fst)

		{

			sw = 0;

			break;

		}

	}

	if(sw)

		printf("Yes\n");

	else

		printf("No\n");

    return 0;

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

using namespace std;

typedef long long ll;

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

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define pb push_back

#define mp make_pair

#define Would

#define you

#define please





int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);



	

	int N;

	cin >> N;

	pair<int, int> P[200000];

	rep(i, N) {

		int a, b;

		cin >> a >> b;

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

	}

	sort(P, P + N);



	ll time = 0;

	bool OK = true;

	rep(i, N) {

		time += P[i].second;

		if (time > P[i].first) OK = false;

	}



	if (OK) co("Yes");

	else co("No");



	Would you please return 0;

}

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

#include<cstdio>

using namespace std;

typedef long long ll;

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

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define pb push_back

#define mp make_pair

#define Would

#define you

#define please



const int cm = 1 << 17;

char cn[cm], * ci = cn + cm, ct;

inline char getcha() {

	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }

	return *ci++;

}

inline int getint() {

	int A = 0;

	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';

	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';

	return A;

}



void pakuripair_sort(int N, int A[], int B[]) {

	const int b = 8;

	int tmp[200001], tmp2[200001];

	rep(k, 4) {

		int kazu[1 << b] = {}, kazu2[1 << b] = {};

		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;

		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];

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

			tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];

			tmp2[kazu[A[i] >> k * b & ((1 << b) - 1)]] = B[i];

		}

		k++;

		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;

		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];

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

			A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];

			B[kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp2[i];

		}

	}

}



int main() {

	//cin.tie(0);

	//ios::sync_with_stdio(false);





	int N = getint();

	int A[200000], B[200000];

	rep(i, N) {

		A[i] = getint();

		B[i] = getint();

	}

	pakuripair_sort(N, B, A);



	ll time = 0;

	bool OK = true;

	rep(i, N) {

		time += A[i];

		if (time > B[i]) OK = false;

	}



	if (OK) printf("Yes");

	else printf("No");



	Would you please return 0;

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

using namespace std;

typedef long long ll;

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

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define pb push_back

#define mp make_pair

#define Would

#define you

#define please



const int cm = 1 << 17;

char cn[cm], * ci = cn + cm, ct;

inline char getcha() {

	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }

	return *ci++;

}

inline int getint() {

	int A = 0;

	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';

	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';

	return A;

}



int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);





	int N = getint();

	pair<int, int> P[200000];

	rep(i, N) {

		int a = getint(), b = getint();

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

	}

	sort(P, P + N);



	ll time = 0;

	bool OK = true;

	rep(i, N) {

		time += P[i].second;

		if (time > P[i].first) OK = false;

	}



	if (OK) co("Yes");

	else co("No");



	Would you please return 0;

}

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

#include<cstdio>

using namespace std;

typedef long long ll;

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

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define pb push_back

#define mp make_pair

#define Would

#define you

#define please



const int cm = 1 << 17;

char cn[cm], * ci = cn + cm, ct;

inline char getcha() {

	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }

	return *ci++;

}

inline int getint() {

	int A = 0;

	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';

	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';

	return A;

}



void pakuripair_sort(int N, int A[], int B[]) {

	const int b = 8;

	int tmp[200001], tmp2[200001];

	rep(k, 4) {

		int kazu[1 << b] = {}, kazu2[1 << b] = {};

		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;

		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];

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

			tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];

			tmp2[kazu[A[i] >> k * b & ((1 << b) - 1)]] = B[i];

		}

		k++;

		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;

		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];

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

			A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];

			B[kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp2[i];

		}

	}

}



int main() {

	//cin.tie(0);

	//ios::sync_with_stdio(false);





	int N = getint();

	int A[200000], B[200000];

	rep(i, N) {

		A[i] = getint();

		B[i] = getint();

	}

	pakuripair_sort(N, B, A);



	ll time = 0;

	bool OK = true;

	rep(i, N) {

		time += A[i];

		if (time > B[i]) OK = false;

	}



	if (OK) printf("Yes");

	else printf("No");



	Would you please return 0;

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

using namespace std;



#define IOS ios::sync_with_stdio(false); cin.tie(0);

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

#define REP(i,n) FOR(i,0,n)

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

#define RALL(n) (n).rbegin(), (n).rend()

using ll = long long;

using ull = unsigned long long;

constexpr int MOD = 1000000007;



int mod(int x){

	return x % MOD;

}



vector<string> split(const string &str, char sep)

{

    vector<string> v;

    stringstream ss(str);

    string buffer;

    while( getline(ss, buffer, sep) ) {

        v.push_back(buffer);

    }

    return v;

}



int main(void)

{

    IOS

    int n;cin >> n; cin.ignore();

    char buf[200010*(10+10+5)];

    cin.read(buf,sizeof buf);

    auto r = cin.gcount();

    //cerr << r << endl;

    buf[r+1] = 0;

    string s(buf,r);

    vector<string> vl=split(s,'\n');

    vector<string> vs;

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

    REP(i,n) {

        vs = split(vl[i],' ');

        int x = stoi(vs[0]), y=stoi(vs[1]);

        v[i] = make_pair(y,x);

    }

    sort(ALL(v));



    int t=0;

    REP(i,n) {

        t += v[i].second;

        //cerr << t << endl;

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

            cout << "No" << endl;

            return 0;

        }

    }



    cout << "Yes" << endl;



    return 0;

}


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

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);

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

#define REP(i,n) FOR(i,0,n)

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

#define RALL(n) (n).rbegin(), (n).rend()

#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';

#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';

#define OUT(n) cout << (n) << '\n';

using ll = long long;

using ull = unsigned long long;

using pii = pair<int,int>;

using pll = pair<ll,ll>;



int main(void)

{

    IOS

    int n; cin >> n;

    vector<pii> v(n);

    REP(i,n) cin >> v[i].second >> v[i].first;

    sort(ALL(v));

    

    bool ans = true;

    ll day = 0;

    REP(i,n) {

        day += v[i].second;

        if (day > v[i].first) {

            ans = false;

            break;

        }

    }



    ATYN(ans)



    return 0;

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

using namespace std;



#define IOS ios::sync_with_stdio(false); cin.tie(0);

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

#define REP(i,n) FOR(i,0,n)

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

#define RALL(n) (n).rbegin(), (n).rend()

using ll = long long;

using ull = unsigned long long;

constexpr int MOD = 1000000007;



int mod(int x){

	return x % MOD;

}



vector<string> split(const string &str, char sep)

{

    vector<string> v;

    stringstream ss(str);

    string buffer;

    while( getline(ss, buffer, sep) ) {

        v.push_back(buffer);

    }

    return v;

}



int main(void)

{

    IOS

    int n;cin >> n; cin.ignore();

    char buf[200010*(10+10+5)];

    cin.read(buf,sizeof buf);

    auto r = cin.gcount();

    //cerr << r << endl;

    buf[r+1] = 0;

    string s(buf,r);

    vector<string> vl=split(s,'\n');

    vector<string> vs;

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

    REP(i,n) {

        vs = split(vl[i],' ');

        int x = stoi(vs[0]), y=stoi(vs[1]);

        v[i] = make_pair(y,x);

    }

    sort(ALL(v));



    int t=0;

    REP(i,n) {

        t += v[i].second;

        //cerr << t << endl;

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

            cout << "No" << endl;

            return 0;

        }

    }



    cout << "Yes" << endl;



    return 0;

}


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

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);

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

#define REP(i,n) FOR(i,0,n)

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

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

#define RALL(n) (n).rbegin(), (n).rend()

#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';

#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';

#define OUT(n) cout << (n) << '\n';

using ll = long long;

using ull = unsigned long long;

using pii = pair<int,int>;

using pll = pair<ll,ll>;



int main(void)

{

    IOS

    int n; cin >> n;

    vector<pii> ab(n);

    REP(i,n) cin >> ab[i].second >> ab[i].first;

    sort(ALL(ab));

    int now = 0;

    bool ok = true;

    REP(i,n) {

        now += ab[i].second;

        if (now > ab[i].first) {

            ok = false;

            break;

        }

    }



    ATYN(ok)



    return 0;

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

#include <algorithm>

using namespace std;

const int maxn=2*100001;

struct WORK{

	int a;

	int b;

};

WORK w[maxn];



bool cmp(WORK x,WORK y){

	return x.b<y.b;

}



int main(){

	int n,t=0;

	cin>>n;

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

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

	}

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

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

		t+=w[i].a;

		if (t>w[i].b){

			cout<<"No"<<endl;

			return 0;

		}

	}

	cout<<"Yes"<<endl;

	return 0;

}

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

#include<algorithm>

using namespace std;

#define ll long long 

struct look{

	ll a,b;

}m[200005];



bool cmp(look e,look f)

{

	return e.b<f.b;

}



int main()

{

	int n;

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

	{

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

		{

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

		}

		sort(m,m+n,cmp);

		ll num=0;

		int flag=0;

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

		{

			num+=m[i].a;

			if(num>m[i].b)

			{

				flag=1;

				break;

			}

		}

		if(flag==0)

		printf("Yes\n");

		else

		printf("No\n");

	 } 

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

using namespace std;

int n,atleast;

struct mis{

	int t;

	int atl;

};

bool cmp(mis a,mis b){

	return a.atl<b.atl;

}

mis a[2000005];

int main(){

	cin>>n;

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

		cin>>a[i].t>>a[i].atl;

	}

	sort(a,a+n,cmp);

	atleast=a[n-1].atl-a[n-1].t;

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

		if(atleast<a[i].atl){

			a[i].atl=atleast;

		}

		else atleast=a[i].atl;

		atleast-=a[i].t;

	}

	if(atleast>=0){

		cout<<"Yes";

	}

	else cout<<"No";

	return 0;

}

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

#include<algorithm>

using namespace std;

#define ll long long 

struct look{

	ll a,b;

}m[200005];



bool cmp(look e,look f)

{

	return e.b<f.b;

}



int main()

{

	int n;

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

	{

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

		{

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

		}

		sort(m,m+n,cmp);

		ll num=0;

		int flag=0;

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

		{

			num+=m[i].a;

			if(num>m[i].b)

			{

				flag=1;

				break;

			}

		}

		if(flag==0)

		printf("Yes\n");

		else

		printf("No\n");

	 } 

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



using namespace std;

typedef long long ll;

//#define int ll

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

#define RALL(a) a.rbegin(), a.rend()

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



typedef pair<int, int> pii;

typedef pair<double, int> pdi;



const int INF = 1000 * 1000 * 1000 + 10;

const ll INFLL = 1000ll * 1000 * 1000 * 1000 * 1000 * 1000;



signed main() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);



#ifdef LOCAL

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

#endif



    int n;

    cin >> n;



    vector<pii> ps;

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

        int a, b;

        cin >> a >> b;

        ps.emplace_back(b, a);

    }



    sort(ALL(ps));



    int t = 0;

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

        int a, b;

        tie(b, a) = ps[i];



        if (t + a > b) {

            cout << "No\n";

            return 0;

        }

        t += a;

    }



    cout << "Yes\n";

}

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

#include<algorithm>

using namespace std;

#define ll long long 

struct look{

	ll a,b;

}m[200005];



bool cmp(look e,look f)

{

	return e.b<f.b;

}



int main()

{

	int n;

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

	{

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

		{

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

		}

		sort(m,m+n,cmp);

		ll num=0;

		int flag=0;

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

		{

			num+=m[i].a;

			if(num>m[i].b)

			{

				flag=1;

				break;

			}

		}

		if(flag==0)

		printf("Yes\n");

		else

		printf("No\n");

	 } 

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



using namespace std;



int main()

{

#ifdef LOCAL

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

#endif // LOCAL

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    int n;

    cin >> n;

    vector <pair<int, int>> p;

    vector <int> a(n);

    vector <int> b(n);

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

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

        p.emplace_back(b[i], i);

    }

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

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

//        cout << p[i].first << " " << p[i].second << " " << a[p[i].second] << endl;

//    }

    long long t = 0;

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

        if (t + a[p[i].second] > b[p[i].second]) {

//            cout << i << endl;

            cout << "No";

            return 0;

        }

        t += a[p[i].second];

    }

    cout << "Yes";

    return 0;

}


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

#include<algorithm>

using namespace std;

#define ll long long 

struct look{

	ll a,b;

}m[200005];



bool cmp(look e,look f)

{

	return e.b<f.b;

}



int main()

{

	int n;

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

	{

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

		{

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

		}

		sort(m,m+n,cmp);

		ll num=0;

		int flag=0;

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

		{

			num+=m[i].a;

			if(num>m[i].b)

			{

				flag=1;

				break;

			}

		}

		if(flag==0)

		printf("Yes\n");

		else

		printf("No\n");

	 } 

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

using namespace std;



typedef pair<int,int> pii;



const int N = 2e5;



pii li[N+5];

int n;

int main(){

	cin >> n;

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

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

	}

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

	int cur = li[n].first;

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

		int lambat = li[i].first - li[i].second;

		cur -= li[i].second;

		cur = min(lambat,cur);

//		cout << cur << endl;

	}

	if(cur < 0) cout << "No\n";

	else cout << "Yes\n";

	return 0;

}


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

#include<algorithm>

using namespace std;

#define ll long long 

struct look{

	ll a,b;

}m[200005];



bool cmp(look e,look f)

{

	return e.b<f.b;

}



int main()

{

	int n;

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

	{

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

		{

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

		}

		sort(m,m+n,cmp);

		ll num=0;

		int flag=0;

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

		{

			num+=m[i].a;

			if(num>m[i].b)

			{

				flag=1;

				break;

			}

		}

		if(flag==0)

		printf("Yes\n");

		else

		printf("No\n");

	 } 

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

#define F first

#define S second

using namespace std;

typedef long long ll;

ll n, t;

int main()

{

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

    cin >> n;

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

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

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

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

    for(auto it : v)

    {

        t += it.S;

        if(t > it.F)

            return cout << "No", 0;

    }

    cout << "Yes";

    return 0;

}


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

#include<algorithm>

using namespace std;

#define ll long long 

struct look{

	ll a,b;

}m[200005];



bool cmp(look e,look f)

{

	return e.b<f.b;

}



int main()

{

	int n;

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

	{

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

		{

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

		}

		sort(m,m+n,cmp);

		ll num=0;

		int flag=0;

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

		{

			num+=m[i].a;

			if(num>m[i].b)

			{

				flag=1;

				break;

			}

		}

		if(flag==0)

		printf("Yes\n");

		else

		printf("No\n");

	 } 

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

using namespace std;

#define ll long long

#define f first

#define s second

int main()

{

    int n,nw=0,f=1;cin>>n;

    pair<int,int>p[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++){

            nw+=p[i].s;

        if(nw>p[i].f)f=0;

    }

    if(f)cout<<"Yes";

    else cout<<"No";

}


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

#include<algorithm>

using namespace std;

#define ll long long 

struct look{

	ll a,b;

}m[200005];



bool cmp(look e,look f)

{

	return e.b<f.b;

}



int main()

{

	int n;

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

	{

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

		{

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

		}

		sort(m,m+n,cmp);

		ll num=0;

		int flag=0;

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

		{

			num+=m[i].a;

			if(num>m[i].b)

			{

				flag=1;

				break;

			}

		}

		if(flag==0)

		printf("Yes\n");

		else

		printf("No\n");

	 } 

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

}


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

#include<algorithm>

using namespace std;

#define ll long long 

struct look{

	ll a,b;

}m[200005];



bool cmp(look e,look f)

{

	return e.b<f.b;

}



int main()

{

	int n;

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

	{

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

		{

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

		}

		sort(m,m+n,cmp);

		ll num=0;

		int flag=0;

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

		{

			num+=m[i].a;

			if(num>m[i].b)

			{

				flag=1;

				break;

			}

		}

		if(flag==0)

		printf("Yes\n");

		else

		printf("No\n");

	 } 

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

}


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

#include<algorithm>

using namespace std;

#define ll long long 

struct look{

	ll a,b;

}m[200005];



bool cmp(look e,look f)

{

	return e.b<f.b;

}



int main()

{

	int n;

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

	{

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

		{

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

		}

		sort(m,m+n,cmp);

		ll num=0;

		int flag=0;

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

		{

			num+=m[i].a;

			if(num>m[i].b)

			{

				flag=1;

				break;

			}

		}

		if(flag==0)

		printf("Yes\n");

		else

		printf("No\n");

	 } 

}