stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}  

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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";

}

// Optimized solution to the same problem (faster):
#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;

}  

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}  

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
//答案错误 

#include<stdio.h>

#include<algorithm>

using namespace std;

struct Gcl

{

	long long num;

	long long shijian;

};

bool cmp(Gcl a,Gcl b){

	if(a.shijian==b.shijian){

		return a.num>b.num; 

	}else{

		return a.shijian<b.shijian;

	}

}struct Gcl s[200010]={};

int main()

{

	

	long long n,i,sum=0;//leap=0;

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

		long long leap=0;

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

			scanf("%lld%lld",&s[i].num,&s[i].shijian);

		}sort(s,s+n,cmp);

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

			sum+=s[i].num;

			if(sum>s[i].shijian){

				leap=1;

				break;

			}

		}if(leap==1){

			printf("No\n");

		}else{

			printf("Yes\n");

		}leap=0;sum=0;

	}

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
//#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
//#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

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

#include<algorithm>

using namespace std; 

struct f{

	int a,b;

}a[1000000];

bool cmp(f d,f e)

{

	return d.b<e.b;

}

int main()

{

	 int n,i,p=0;

	 scanf("%d",&n);

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

	 {

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

	 }

	 sort(a,a+n,cmp);

	 long long int s=0;

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

	 {

	 	s+=a[i].a;

	 	if(s>a[i].b)

	 	{

		 p=1;

		 break;

		}

     }

     if(p==0)

     printf("Yes\n");

     else

     printf("No\n"); 

	 

}

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

using namespace std;

int 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;

}

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

#include<algorithm>

using namespace std; 

struct f{

	int a,b;

}a[1000000];

bool cmp(f d,f e)

{

	return d.b<e.b;

}

int main()

{

	 int n,i,p=0;

	 scanf("%d",&n);

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

	 {

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

	 }

	 sort(a,a+n,cmp);

	 long long int s=0;

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

	 {

	 	s+=a[i].a;

	 	if(s>a[i].b)

	 	{

		 p=1;

		 break;

		}

     }

     if(p==0)

     printf("Yes\n");

     else

     printf("No\n"); 

	 

}

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



using namespace std;

typedef long long ll;

//#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";

}

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

#include<algorithm>

using namespace std; 

struct f{

	int a,b;

}a[1000000];

bool cmp(f d,f e)

{

	return d.b<e.b;

}

int main()

{

	 int n,i,p=0;

	 scanf("%d",&n);

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

	 {

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

	 }

	 sort(a,a+n,cmp);

	 long long int s=0;

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

	 {

	 	s+=a[i].a;

	 	if(s>a[i].b)

	 	{

		 p=1;

		 break;

		}

     }

     if(p==0)

     printf("Yes\n");

     else

     printf("No\n"); 

	 

}

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



using namespace std;



int main()

{

#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;

}


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

#include<algorithm>

using namespace std; 

struct f{

	int a,b;

}a[1000000];

bool cmp(f d,f e)

{

	return d.b<e.b;

}

int main()

{

	 int n,i,p=0;

	 scanf("%d",&n);

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

	 {

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

	 }

	 sort(a,a+n,cmp);

	 long long int s=0;

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

	 {

	 	s+=a[i].a;

	 	if(s>a[i].b)

	 	{

		 p=1;

		 break;

		}

     }

     if(p==0)

     printf("Yes\n");

     else

     printf("No\n"); 

	 

}

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

using namespace std;



typedef 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;

}


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

#include<algorithm>

using namespace std; 

struct f{

	int a,b;

}a[1000000];

bool cmp(f d,f e)

{

	return d.b<e.b;

}

int main()

{

	 int n,i,p=0;

	 scanf("%d",&n);

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

	 {

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

	 }

	 sort(a,a+n,cmp);

	 long long int s=0;

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

	 {

	 	s+=a[i].a;

	 	if(s>a[i].b)

	 	{

		 p=1;

		 break;

		}

     }

     if(p==0)

     printf("Yes\n");

     else

     printf("No\n"); 

	 

}

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

#define 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;

}


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

#include<algorithm>

using namespace std; 

struct f{

	int a,b;

}a[1000000];

bool cmp(f d,f e)

{

	return d.b<e.b;

}

int main()

{

	 int n,i,p=0;

	 scanf("%d",&n);

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

	 {

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

	 }

	 sort(a,a+n,cmp);

	 long long int s=0;

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

	 {

	 	s+=a[i].a;

	 	if(s>a[i].b)

	 	{

		 p=1;

		 break;

		}

     }

     if(p==0)

     printf("Yes\n");

     else

     printf("No\n"); 

	 

}

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

using namespace std;

#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";

}


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

#include<algorithm>

using namespace std; 

struct f{

	int a,b;

}a[1000000];

bool cmp(f d,f e)

{

	return d.b<e.b;

}

int main()

{

	 int n,i,p=0;

	 scanf("%d",&n);

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

	 {

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

	 }

	 sort(a,a+n,cmp);

	 long long int s=0;

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

	 {

	 	s+=a[i].a;

	 	if(s>a[i].b)

	 	{

		 p=1;

		 break;

		}

     }

     if(p==0)

     printf("Yes\n");

     else

     printf("No\n"); 

	 

}

// Fastest known solution for this problem: