jiahuimbzuai/CoQuIR huggingface dataset:
//  [c]
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include<math.h>
int main(){
    long long a,b,c,d, eq1=0, eq2=0, eq3=0, eq4=0;
    scanf("%lld %lld %lld %lld", &a,&b,&c,&d);
    eq1= a*c;
    eq2= a*d;
    eq3= b*c;
    eq4= b*d;
    if(eq1>= eq2 && eq1>= eq3 && eq1>= eq4)
        printf("%lld", eq1);
    else if(eq2>= eq1 && eq2>= eq3 && eq2>= eq4)
        printf("%lld", eq2);
    else if(eq3>= eq1 && eq3>= eq2 && eq3>= eq4)
        printf("%lld", eq3);
    else if(eq4>= eq1 && eq4>= eq3 && eq4>= eq2)
        printf("%lld", eq4);
    printf("\n");
    return 0;
}
//  [c]
#include<stdio.h>

int main(){
        long long a, b, c, d, ans;
        scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
        ans=a*c;
        if(ans<a*d)ans=a*d;
        if(ans<b*c)ans=b*c;
        if(ans<b*d)ans=b*d;
        printf("%lld" ans);
        return 0;
}
//  [c]
#include<stdio.h>
int main()
{
  long int a,b,c,d,i;
  long long int e[4],n;
  scanf("%ld %ld %ld %ld",&a,&b,&c,&d);
  e[0]=a*c;e[1]=a*d;e[2]=b*c;e[3]=b*d;
  n=e[0];printf("%d\n",n);
  for(i=1;i<=3;i++)
  {
    if(n < e[i])
    {
      n=e[i];
    }
  }
  printf("%lld",n);
}
//  [c]
#include<stdio.h>
int main()
{
  int a,b,c,d,i;
  int e[4],n;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  e[0]=a*c;e[1]=a*d;e[2]=b*c;e[3]=b*d;
  n=e[0];
  for(i=1;i<=3;i++)
  {
    if(n < e[i])
    {
      n=e[i];
    }
  }
  printf("%d",n);
}
//  [javascript]
'use script';

{
function Main(input) {
	//input = input.split("\n");
	tmp = input.split(" ");
	const a = BigInt(tmp[0], 10);
	const b = BigInt(tmp[1], 10);
	const c = BigInt(tmp[2], 10);
	const d = BigInt(tmp[3], 10);

  	let max = a*c;
  
	if(max < a*d){
      max = a*d;
    }
	if(max < b*c){
      max = b*c;
    }
  	if(max < b*d){
      max = b*d;
    }
  
  	console.log(max.toString());
  
	}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

}
//  [javascript]
function Main(input) {
	input = input.trim().split(" "); 
	var a = BigInt(input[0], 10);
	var b = BigInt(input[1], 10);
    var c = BigInt(input[2], 10);
    var d = BigInt(input[3], 10);
    
  	var ans = a * c;
  	if(a * d > ans) ans = a * d;
  	if(b * c > ans) ans = b * c;
  	if(b * d > ans) ans = b * d;

    console.log(ans.toString());
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
const main = arg => {
  const [a,b,c,d] = arg.trim().split(' ').map(x => BigInt(x));
  let max = a * c
  if (a * d > max) max = a * d
  if (b * c > max) max = b * c
  if (b * d > max) max = b * d
  console.log(max.toString())
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
const Main = (input) => {
  const[A,B,C,D] = input.split(' ').map(Number);
  const numbers = [A * C, A * D, B * C, C * D];
 
  console.log(Math.max.apply(null, numbers));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main(`-1000000000 0 -1000000000 0`);
//  [javascript]
const Main = (input) => {
  const[A,B,C,D] = input.split(' ').map(Number);
  let numbers = [];
  for(let i = A; i <= B; i++) {
    for(let j = C; j <= D; j++) {
      numbers.push(i*j);
    }
  }
  console.log(Math.max.apply(null, numbers));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main(`-1000000000 0 -1000000000 0`);
//  [javascript]
const main = arg => {
  const [a, b, c, d] = arg.split(' ').map(BigInt);
  const ary = [a * c, a * d, b * c, b * d];
  const max = ary.reduce((x, y) => x > y ? x : y);
  console.log(Number(max));
};
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	a, b, c, d := r.nextInt(), r.nextInt(), r.nextInt(), r.nextInt()

	maxInt := func(a int, vs ...int) int {
		for i := range vs {
			v := &vs[i]
			if a < *v {
				a = *v
			}
		}
		return a
	}
	fmt.Fprintln(stdout, maxInt(a*c, a*d, b*c, b*d))
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

func main() {
	fmt.Println(abc178b(os.Stdin))
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextLine(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func abc178b(r io.Reader) int {
	sc := bufio.NewScanner(r)
	sc.Split(bufio.ScanWords)

	a, b, c, d := nextInt(sc), nextInt(sc), nextInt(sc), nextInt(sc)

	//最大値、最小値スライス作成
	s := []int{a * c, a * d, b * c, b * d}
	sort.Sort(sort.Reverse(sort.IntSlice(s)))

	return s[0]
}
//  [go]
package main
 
import (
  "os"
  "fmt"
  "bufio"
  "strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
  sc.Scan()
  i, err := strconv.Atoi(sc.Text())
  if err != nil {
    panic(err)
  }
  return i
}

func main() {
  sc.Split(bufio.ScanWords)
  
  a := nextInt()
  b := nextInt()
  c := nextInt()
  d := nextInt()
  max := a * c
  if b * d > max {
    max = b * d
  }
  if a * d > max {
  	max = a * d
  }
  if b * c > max {
    max = b * c
  }
  fmt.Println(max)
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)

	res := math.MinInt64
	for i := a; i <= b; i++ {
		for j := c; j <= d; j++ {
			product := i * j
			if product > res {
				res = product
			}
		}
	}

	fmt.Println(res)
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, c, d int
	var ans1 int
	var ans2 int
	fmt.Scan(&a, &b, &c, &d)
	ans1 = max(a*c, a*d)
	ans2 = max(b*c, b*d)
	fmt.Println(max(ans1, ans2))

}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}
//  [go]
package main

import "fmt"

func main() {
	nums := make([]int, 4)
	for i:=0; i<len(nums); i++{
		fmt.Scan(&nums[i])
	}

	max := 0
	for i:=0; i<2; i++{
		if max < nums[i] * nums[2]{
			max = nums[i] * nums[2]
		}
		if max < nums[i] * nums[3]{
			max = nums[i] * nums[3]
		}
	}
	fmt.Println(max)
}
//  [ruby]
a,b,c,d = gets.chomp.split(' ').map(&:to_i)
ab = [a,b].sort
cd = [c,d].sort
ans = []
ans << ab[0]*cd[0]
ans << ab[0]*cd[1]
ans << ab[1]*cd[0]
ans << ab[1]*cd[1]
ans = ans.sort
p ans [-1]
//  [ruby]
a,b,c,d = gets.split.map(&:to_i)
puts [a*c, a*d, b*c, b*d].max
//  [ruby]
a,b,c,d=gets.split.map &:to_i
p [a*c,a*d,b*c,b*d].max
//  [ruby]
a,b,c,d = gets.split.map(&:to_i)
puts [a*c,a*d,b*c,d*d].max
//  [ruby]
a,b,c,d = gets.split(" ").map(&:to_i)
z = []
(a..b).each do |x|
  (c..d).each do |y|
    z << x * y
  end
end

puts z.max
//  [ruby]
line = gets.split(' ')
if line[0] > line[1] then
   x = line[0]    
else 
   x = line[1]
end 

if line[2] > line[3] then
   y = line[2]    
else 
   y = line[3]
end 
max = x.to_i * y.to_i
p max
//  [rust]
use proconio::fastout;
use whiteread::parse_line;

#[fastout]
fn main() {
    let (a, b, c, d): (i64, i64, i64, i64) = parse_line().unwrap();

    println!(
        "{}",
        *[a*c, a*d, b*c, b*d].iter().max().unwrap()
    );
}
//  [rust]
use proconio::input;
use proconio::marker::Chars;
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused)]
const ALPHA_SMALL: [char; 26] = [
    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
    't', 'u', 'v', 'w', 'x', 'y', 'z',
];
#[allow(unused)]
const ALPHA: [char; 26] = [
    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
    'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
];
macro_rules! maxs {
    ($x:expr, $($y:expr), *) => {{
        let mut ret = $x;
        $(
            ret = max(ret, $y);
        )*
        ret
    }};
}
fn main() {
    input!(a: i64, b: i64, c: i64, d: i64);
    let ans = maxs!(a * c, b * d, a * d, b * c);
    println!("{}", ans);
}
//  [rust]
use proconio::input;
use std::cmp;

fn main() {
    input! {
        a: i64,
        b: i64,
        c: i64,
        d: i64,
    }

    if (a > 0 && d < 0) || (b < 0 && c > 0) {
        // 負の数しか作れない
        let x = cmp::min(a.abs(), b.abs());
        let y = cmp::min(c.abs(), d.abs());
        println!("{}", - x * y);
    } else {
        let x = cmp::max(a.abs(), b.abs());
        let y = cmp::max(c.abs(), d.abs());
        println!("{}", x * y);
    }
}
//  [rust]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
.split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    // solver code...
    let tmp_vec = read_vec::<i64>();

    let mut ans = -1 * (10^20);
    for x in 0..2 {
        for y in 2..4 {
                let tmp_ans = tmp_vec[x] * tmp_vec[y];
                ans = std::cmp::max(ans, tmp_ans);
        }
    }
    println!("{}", ans);
}
//  [rust]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
.split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    // solver code...
    let tmp_vec = read_vec::<i64>();

    let mut ans = -1 * (10^18);
    for x in 0..2 {
        for y in 2..4 {
                let tmp_ans = tmp_vec[x] * tmp_vec[y];
                ans = std::cmp::max(ans, tmp_ans);
        }
    }
    println!("{}", ans);
}
//  [swift]
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main1() {
    let param = readInts()
    
    var ans = param[1] * param[3]
    
    for i in 0...1 {
        for j in 2...3 {
            if (param[i] * param[j] > ans){
                ans = param[i] * param[j]
            }
        }
    }
    
    print(ans)
}

main1()
//  [swift]
let x = readLine()!.split(separator: " ").map {Int($0)!}
var resultArray: [Int] = []
for i in 0..<2 {
    for j in 2..<4 {
        resultArray.append(x[i]*x[j])
    }
}
print(resultArray.max()!)
//  [swift]
let abcd = readLine()!.split(separator: " ").compactMap { Int($0) }
let a = abcd[0]
let b = abcd[1]
let c = abcd[2]
let d = abcd[3]

print(max(a * c, a * d, b * c, b * d))
//  [swift]
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main1() {
    let param = readInts()
    
    var ans = param[1] * param[3]
    
    for x in param[0]...param[1] {
        for y in param[2]...param[3] {
            if (x * y) > ans {
                ans = x * y
            }
        }
    }
    
    print(ans)
}

main1()
//  [swift]
import Foundation

let line = readLine()!.components(separatedBy: " ")
let a = Double(line[0])!
let b = Double(line[1])!
let c = Double(line[2])!
let d = Double(line[3])!

var m: Double = a * c
m = max(m, a * d)
m = max(m, b * c)
m = max(m, b * d)
print(Int(m))
//  [typescript]
import * as fs from 'fs';

function bigMax(...a: bigint[]): bigint {
  return a.reduce((prev, current) => prev > current ? prev : current);
}
function main(input) {
  input = input.split('\n');
  const [a, b, c, d]: bigint[] = input[0].split(' ').map(i => BigInt(parseInt(i)));
  console.log('%s', bigMax(a * c, a * d, b * c, b * d).toString());
}

main(fs.readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
"use strict"
let fs = require('fs');
let input = fs.readFileSync("/dev/stdin", "utf8").split(/\s/);
 
const a = BigInt(input[0]);
const b = BigInt(input[1]);
const c = BigInt(input[2]);
const d = BigInt(input[3]);
 
const ac = a * c;
const ad = a * d;
const bc = b * c;
const bd = b * d;

let ans = ac;
ans = ans < ad ? ad : ans;
ans = ans < bc ? bc : ans;
ans = ans < bd ? bd : ans;
 
console.log(String(ans).replace('n', ''));
//  [typescript]
import { readFileSync } from "fs";

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const range = (n: number | bigint) => [...Array(Number(n))].map((_, i) => i);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const tuple = <T extends unknown[]>(...ts: T) => ts;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [cin, nCin, bCin] = (() => {
  const inputs = readFileSync("/dev/stdin", "utf-8").split(/[\n|\s]+/);
  let count = 0;
  const cin = () => inputs[count++];
  return tuple(
    cin,
    () => Number(cin()),
    () => BigInt(cin())
  );
})();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const isNumber = (x: unknown): x is number => typeof x === "number";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const isBigint = (x: unknown): x is bigint => typeof x === "bigint";
type NumberOrBigintOrElse<T> = number | bigint extends T
  ? undefined
  : T extends number
  ? number
  : T extends bigint
  ? bigint
  : undefined;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const max = <T extends number | bigint>(...ts: T[]) =>
  (ts.length === 0
    ? undefined
    : isNumber(ts[0])
    ? Math.max(...(ts as number[]))
    : (ts as bigint[]).reduce((acc, t) =>
        acc >= t ? acc : t
      )) as NumberOrBigintOrElse<T>;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const min = <T extends number | bigint>(...ts: T[]) =>
  (ts.length === 0
    ? undefined
    : isNumber(ts[0])
    ? Math.min(...(ts as number[]))
    : (ts as bigint[]).reduce((acc, t) =>
        acc <= t ? acc : t
      )) as NumberOrBigintOrElse<T>;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const abs = <T extends number | bigint>(t: T) =>
  (isNumber(t)
    ? Math.abs(t)
    : isBigint(t)
    ? t >= 0n
      ? t
      : -t
    : undefined) as NumberOrBigintOrElse<T>;

/**
 * Program
 */
const getAns = (a: bigint, b: bigint, c: bigint, d: bigint): string =>
  max(a * c, a * d, b * c, b * d).toString();

{
  const [a, b, c, d] = [bCin(), bCin(), bCin(), bCin()];
  const ans = getAns(a, b, c, d);
  console.log(ans);
}
//  [typescript]
import * as fs from "fs";

const input = fs.readFileSync("/dev/stdin", "utf8");
const a = +input.split(" ")[0];
const b = +input.split(" ")[1];
const c = +input.split(" ")[2];
const d = +input.split(" ")[3];

const ac = a * c;
const ad = a * d;
const bc = b * c;
const bd = b * d;

let max = ac;

if (ac >= ad && ac >= bc && ac >= bd) {
  max = ac;
} else if (ad >= ac && ad >= bc && ad >= bd) {
  max = ad;
} else if (bc >= ac && bc >= ad && bc >= bd) {
  max = bc;
} else if (bd >= ac && bd >= ad && bd >= bc) {
  max = bd;
}

console.log(max);
//  [typescript]
import * as fs from "fs";

const input = fs.readFileSync("/dev/stdin", "utf8");
const a = +input.split(" ")[0];
const b = +input.split(" ")[1];
const c = +input.split(" ")[2];
const d = +input.split(" ")[3];

const ac = a * c;
const ad = a * d;
const bc = b * c;
const bd = b * d;

let max = ac;

if (ac >= ad && ac >= bc && ac >= bd) {
  max = ac;
} else if (ad >= ac && ad >= bc && ad >= bd) {
  max = ad;
} else if (bc >= ac && bc >= ad && bc >= bd) {
  max = bc;
} else {
  max = bd;
}

console.log(max);
//  [python]
import sys
import numpy as np

n = int(input())
a, b = np.fromstring(sys.stdin.read(), dtype=np.uint32, sep=' ').reshape((n, 2)).T
i = b.argsort()
print('Yes' if (np.add.accumulate(a[i]) <= b[i]).all() else 'No')
//  [python]
import sys
import numpy as np

N = int(sys.stdin.readline())
ind = np.fromstring(sys.stdin.read(), dtype='i8', sep=' ').reshape((N, 2))
a = ind[:, 0]
b = ind[:, 1]
arg = np.argsort(b)
a = a[arg]
b = b[arg]
ac = np.add.accumulate(a)
if np.all(b - ac >= 0):
    print('Yes')
else:
    print('No')
//  [python]
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# 締切の近いものから詰め込む

import numpy as np

N = int(readline())
AB = np.array(read().split(),np.int64)

A = AB[::2]; B = AB[1::2]

ind = B.argsort(); A = A[ind]; B = B[ind]

answer = 'Yes' if np.all(A.cumsum() <= B) else 'No'
print(answer)
//  [python]
def main():
    n = int(input())
    ab_lst = [list(map(int, input().split())) for _ in range(n)]

    ba_lst = [0] * n
    for i in range(n):
        a = ab_lst[i][0]
        b = ab_lst[i][1]
        ba = [b, a]
        ba_lst[i] = ba
    ba_lst.sort()

    lst = []
    b = ba_lst[0][0]
    a = ba_lst[0][1]
    for i in range(n):
        b_tmp = ba_lst[i][0]
        a_tmp = ba_lst[i][1]

        if b == b_tmp:
            if i != 0:
                a += a_tmp
            if i == n - 1:
                lst.append([b, a])

        else:
            lst.append([b, a])
            b = b_tmp
            a = a_tmp

    if ba_lst[-1][0] != ba_lst[-2][0]:
        lst.append([ba_lst[-1][0], ba_lst[-1][1]])

    print(lst)

    accumulate = 0
    flag = True
    for i in range(len(lst)):
        accumulate += lst[i][1]
        if accumulate > lst[i][0]:
            flag = False
            break

    if flag:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()
//  [python]
n = int(input())
work = [list(map(int,input().split())) for _ in range(n)]
work = sorted(work,key = lambda x:x[1])
a = [0] * n
a[0] = work[0][0]
for i in range(1,N):
    a[i] = a[i-1] + work[i][0]
ans = 'Yes'
for j in range(N):
    if a[j] > work[j][1]:
        ans = 'No'
        break
print(ans)
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {
    int N;
    int[] A,B;
    private class Task implements Comparable<Task> {
        int take, end;
        public Task(int take, int end) {
            this.take = take;
            this.end = end;
        }

        public int compareTo(Task task) {
            if (this.end == task.end) {
                return this.take - task.take;
            }
            return this.end - task.end;
        }
    }
    private void solve() {
        N = nextInt();
        A = new int[N];
        B = new int[N];
        for(int i = 0;i < N;i++) {
            A[i] = nextInt();
            B[i] = nextInt();
        }

        PriorityQueue<Task> pq = new PriorityQueue<>();
        for(int i = 0;i < N;i++) {
            pq.add(new Task(A[i], B[i]));
        }

        int now = 0;
        while(!pq.isEmpty()) {
            Task task = pq.poll();

            if (now + task.take > task.end) {
                out.println("No");
                return;
            }
            now = now + task.take;
        }

        out.println("Yes");
    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[4096];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}
//  [java]
import java.util.*;
import java.io.*;

class Main{
    public static void main(String[] args){
        FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        int[][] ab = new int[n][2];
        for(int i=0;i<n;i++){
            ab[i][0] = fs.nextInt();
            ab[i][1] = fs.nextInt();
        }
        Arrays.sort(ab,new Comparator<int[]>(){
			@Override
			public int compare(int[] o1, int[] o2) {
				return o1[1]-o2[1];
			}
        });
        int now = 0;
        for(int i=0;i<n;i++){
            now+=ab[i][0];
            if(now > ab[i][1]){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
    static class FastScanner{
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte(){
            if(ptr < buflen){
                return true;
            }else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen <= 0){
                    return false;
                }
            }
            return true;
        }

        private int readByte(){
            if(hasNextByte())return buffer[ptr++];
            else return -1;
        }

        private boolean isPrintableChar(int c){
            return 33<=c && c<=126;
        }

        public boolean hasNext(){
            while(hasNextByte() && !isPrintableChar(buffer[ptr]))ptr++;
            return hasNextByte();
        }

        public String next(){
            if(!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)){
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong(){
            if(!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if(b == '-'){
                minus = true;
                b = readByte();
            }
            if(b < '0' || '9' < b){
                throw new NumberFormatException();
            }
            while(true){
                if('0' <= b && b<='9'){
                    n*=10;
                    n+=b-'0';
                }else if(b==-1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt(){
            long nl = nextLong();
            if(nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)throw new NumberFormatException();
            return (int)nl;
        }
        public double nextDouble(){return Double.parseDouble(next());}
    }
}
//  [java]

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;

import atCoder.abc177.f.Main.Pair;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		PriorityQueue<Pair> q = new PriorityQueue<Pair>();
		Pair[] a = new Pair[n];
		
		for( int i=0 ; i<n ; i++ ) {
			a[i] = new Pair(sc.nextInt(), sc.nextInt() );
			q.add(a[i]);
		}
		
		Arrays.sort(a);
		
		boolean canFinish = true;
		int time =0;
		for( int i = 0 ; i< n ; i++ ) {
			time+= a[i].weight;
			if( a[i].limit < time ) {
				canFinish = false;
				break;
			}
		}
		
		if( canFinish ) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		

	}

	public static class Pair implements Comparable<Pair>{
		int weight = 0;
		int limit = 0;
		
		public Pair(int weight, int limit) {
			super();
			this.weight = weight;
			this.limit = limit;
		}

		@Override
		public int compareTo(Pair o) {
			return limit - o.limit;
		}
	
	}
}
//  [java]
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;


	public class Main {
		
		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			
			int n = sc.nextInt();
			long[] a = new long[n];
			long[] b = new long[n];
			HashMap<Long,Long> m = new HashMap<Long,Long>();
			
			for(int i=0;i<n;i++) {
				a[i] = sc.nextLong();
				b[i] = sc.nextLong();
			}
			
			for(int i=0;i<n;i++) {
				m.merge(b[i], a[i], Long::sum);
			}
			
			for(Map.Entry<Long, Long> e :m.entrySet()) {
				if(e.getKey()<e.getValue()) {
					System.out.println("No");
					return;
				}
			}
			
			System.out.println("Yes");
	    }
		
	}
//  [cpp]
//#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;
}
//  [cpp]
#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;
}
//  [cpp]
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

//#include <boost/unordered_map.hpp>
//using namespace boost;

/*
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
rbtree T;
*/

namespace io{
	const int L = (1 << 20) + 1;

	char buf[L], *S , *T, c;

	char getchar() {
		if(__builtin_expect(S == T, 0)) {
			T = (S = buf) + fread(buf, 1, L, stdin);
			return (S == T ? EOF : *S++);
		}
		return *S++;
	}

	int inp() {
		int x = 0, f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}

	unsigned inpu()
	{
		unsigned x = 0; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar());
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x;
	}

	ll inp_ll() {
		ll x = 0; int f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}

	char B[45], *outs=B+40, *outr=B+40;
	template<class T>
	inline void print(register T a,register char x=0){
		if(x) *--outs = x, x = 0;

		if(!a)*--outs = '0';
		else
			while(a)
				*--outs = (a % 10) + 48, a /= 10;

		if(x)
			*--outs = x;

		fwrite(outs, outr - outs , 1, stdout);
		outs = outr;
	}
};

using io :: print;
using io :: inp;
using io :: inpu;
using io :: inp_ll;

using i32 = int;
using i64 = long long;
using u8 = unsigned char;
using u32 = unsigned;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;
//using i128 = __int128_t;
//using u128 = __uint128_t;
using i128 = i64;
using u128 = u64;

ll power(ll a, ll b, ll p)
{
	if (!b) return 1;
	ll t = power(a, b/2, p);
	t = t*t%p;
	if (b&1) t = t*a%p;
	return t;
}

ll exgcd(ll a, ll b, ll &x, ll &y)
{
	if (b == 0)
	{
		x = 1;
		y = 0;
		return a;
	}
	ll px, py;
	ll d = exgcd(b, a%b, px, py);
	x = py;
	y = px-a/b*py;
	return d;
}

template<class T>
inline void freshmin(T &a, const T &b)
{
	if (a > b) a = b;
}

template<class T>
inline void freshmax(T &a, const T &b)
{
	if (a < b) a = b;
}

const int MOD = 1000000007;
const int INF = 1000000000;
const int MAXN = 200010;

int n;
pll v[MAXN];

int main()
{
	
	n = inp();
	for (int i = 1; i <= n; ++ i)
	{
		ll x = inp();
		ll y = inp();
		v[i] = pll(y, x);
	}
	sort(v+1, v+n+1);
	ll cur = 0;
	for (int i = 1; i <= n; ++ i)
	{
		cur += v[i].Y;
		if (cur > v[i].X)
		{
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	
	return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

int main()
{
    ll n;
    cin>>n;
    ll sum =0;
    ll  maxB = INT_MIN;
    for(int i=0;i<n;i++)
    {
        ll a , b;
        cin>>a>>b;
        sum += a;
        maxB = max( maxB , b);
    }
    if( sum <= maxB )
    {
        cout<<"Yes";
    }
    else cout<<"No";
}
//  [cpp]
/*
"Won't stop until I'm phenomenal."
- Phenomenal, Eminem
 */
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define ff first
#define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define ss second
#define all(c) c.begin(),c.end()
#define endl "\n"
#define test() int t; cin>>t; while(t--)
#define fl(i,a,b) for(int i = a ; i <b ;i++)
#define get(a) fl(i,0,a.size())  cin>>a[i];
#define pra(a) fl(i,0,a.size()) cout<<a[i]<<" ";	cout<<endl;
#define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;
const ll INF = 2e18;
const int inf = 2e9;
const int mod1 = 1e9 + 7;



int main(){
    Shazam;
    int n; cin>>n;
    vector<pair<int,int>> a(n);
    for(int i = 0 ; i < n; i++)
        cin>>a[i].ss>>a[i].ff;
    sort(all(a));
    int t = 0;
    bool can = true;
    for(int i = 0 ; i < n; i++){
        if(a[i].ff<t){
            can = false;
            break;
        }
        t += a[i].ss;
    }
    cout<<((can)?"Yes":"No")<<endl;
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const int INF=1e9;
const ll llINF=1e18;
const int MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
 
int main() {
  ll n;
  cin>>n;
  vi a(n),b(n);
  ll sum=0;
  rep(i,n){
    cin>>a[i]>>b[i];
    sum+=a[i];
  }
  sort(all(a)); sort(all(b));
  reverse(all(a)); reverse(all(b));
  rep(i,n){
    if(b[i]<sum){
      cout<<"No"<<endl;
      return 0;
    }
    sum-=a[i];
  }
  cout<<"Yes"<<endl;
}
//  [c]
// AtCoder ABC131: D - Megalomania
// 2019.9.4 bal4u

#include <stdio.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

typedef struct { int a, b; } T;
T t[200005]; int N;

void Qsort(T *a, int l, int r) {
	int i, j, m; T t;
	
	i = l, j = r, m = a[(l+r) >> 1].b;
	while (1) {
		while (a[i].b < m) i++;
		while (m < a[j].b) j--;
		if (i >= j)	break;
		t = a[i], a[i] = a[j], a[j] = t;
		i++, j--;
	}
	if (l+1 < i) Qsort(a, l, i-1);
	if (j+1 < r) Qsort(a, j+1, r);
}

int main()
{
	int i, s;
	
	N = in(); for (i = 0; i < N; i++) {
		t[i].a = in(), t[i].b = in();
		if (t[i].a > t[i].b) goto No;
	}
	Qsort(t, 0, N-1);
	s = 0; for (i = 0; i < N; i++) {
		s += t[i].a;
		if (s > t[i].b) goto No;
	}
	puts("Yes"); return 0;
No: puts("No");  return 0;
}
//  [c]
// AtCoder ABC131: D - Megalomania
// 2019.9.4 bal4u

#include <stdio.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

typedef struct { int a, b; } T;
T t[200005]; int N;

void Qsort(T *a, int l, int r) {
	int i, j, m; T t;
	
	i = l, j = r, m = a[(l+r) >> 1].b;
	while (1) {
		while (a[i].b < m) i++;
		while (m < a[j].b) j--;
		if (i >= j)	break;
		t = a[i], a[i] = a[j], a[j] = t;
		i++, j--;
	}
	if (l+1 < i) Qsort(a, l, i-1);
	if (j+1 < r) Qsort(a, j+1, r);
}

int main()
{
	int i, s;
	
	N = in(); for (i = 0; i < N; i++) t[i].a = in(), t[i].b = in();
	Qsort(t, 0, N-1);
	s = 0; for (i = 0; i < N; i++) {
		s += t[i].a;
		if (s > t[i].b) goto No;
	}
	puts("Yes"); return 0;
No: puts("No");  return 0;
}
//  [c]
// AtCoder ABC131: D - Megalomania
// 2019.9.4 bal4u

#include <stdio.h>

typedef long long ll;

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

ll t[200005]; int N;

void Qsort(ll *a, int l, int r) {
	int i, j; ll m, t;
	
	i = l, j = r, m = a[(l+r) >> 1];
	while (1) {
		while (a[i] < m) i++;
		while (m < a[j]) j--;
		if (i >= j)	break;
		t = a[i], a[i] = a[j], a[j] = t;
		i++, j--;
	}
	if (l+1 < i) Qsort(a, l, i-1);
	if (j+1 < r) Qsort(a, j+1, r);
}

int main()
{
	int i, a, b; ll s;
	
	N = in(); for (i = 0; i < N; i++) {
		a = in(), b = in();
		t[i] = ((ll)b << 32) | a;
	}
	Qsort(t, 0, N-1);
	s = 0; for (i = 0; i < N; i++) {
		s += t[i] & 0xffffffff;
		if (s > (t[i] >> 32)) goto No;
	}
	puts("Yes"); return 0;
No: puts("No");  return 0;
}
//  [c]
#include "bits/stdc++.h"
using namespace std;
int main(){
    int N,time;
    bool res=true;
    cin >>N;
    vector<pair<int,int>> task(N);
    for(int i=0;i<N;i++){
        int a,b;
        cin>>a>>b;
        pair<int,int> t(b,a);
        task[i]=t;
    }
    sort(task.begin(),task.end());
    for(int i=0;i<N;i++){
      	time+=task[i].second;
      	//cout<<task[i].second<<" "<<task[i].first<<endl;
        if(time>task[i+1].first){
            res=false;
            break;
        }
    }
    if(res) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
//  [c]
#include <bits/stdc++.h>

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
int main()
{
	int n;
	cin >> n;
	vector<P> a(n);
	rep(i,n) cin >> a[i].second >> a[i].first; // 締切,所要時間
	SORT(a);
	int time = 0;
	rep(i,n){
		if(time + a[i].second <= a[i].first){
			// 間に合う
			time += a[i].second;
		} else {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}
//  [c]
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
 
typedef long long ll;
const ll MOD = 1e9+7;
const ll INF = 1e18;


#define PB push_back
#define MP make_pair
#define F first
#define S second

template<typename T,typename U>
bool chmax(T& max, const U& x){
	if(max<x){
		max = x;
		return true;
	}
	return false;
}

template<typename T,typename U>
bool chmin(T& min, const U& x){
	if(min>x){
		min = x;
		return true;
	}
	return false;
}
bool compare_by_second(pair<ll,ll> a,pair<ll,ll> b){
    if(a.S != b.S){
        return a.S < b.S;
    }else{
        return a.F < b.F;
    }
}

vector<pair<ll,ll>> task;

int main(){
    ll n;
    cin >> n;
    for(ll i=0;i<n;i++){
        ll tmp,tmp2;
        cin >> tmp >> tmp2;
        task.PB(MP(tmp,tmp2));
    }
  	
    sort(task.begin(),task.end(),compare_by_second);
    ll sum=0;
    for(auto &e: task){
        sum+=e.F;
        if(sum>e.S){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}
//  [javascript]
function Main(input) {
    input = input.trim().split("\n");
    var tmp = input[0].split(" ");
    var N = parseInt(tmp[0], 10);
    var AB = [];
    for (var i = 1; i < N + 1; i++){
        tmp = input[i].split(" ");
        AB[i-1] = {A:parseInt(tmp[0],10),B:parseInt(tmp[1],10)}
    }
    AB.sort(function (a, b) {
        if (a.B < b.B) return -1;
        if (a.B > b.B) return 1;
        return 0;
    });
    var time = 0;
    var judge = "Yes";
    for (var i = 0; i < N; i++){
        time += AB[i].A;
        if (time > AB[i].B) {
            judge = "No";
            break;
        }
    }
    console.log(judge);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=r(1);r(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var n=r(3),i=r(5);t.exports=function(t){var e=new n(t);i(e)}},function(t,e,r){"use strict";var n=r(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new n(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,r){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,r){"use strict";t.exports=function(t){for(var e=t.in(),r=new Array(e),n=0;n<e;n++){var i=t.in(),o=t.in();r[n]={a:i,b:o}}r.sort(function(t,e){return t.b-e.b});for(var s=0,u=0;u<e;u++)if((s+=r[u].a)>r[u].b)return void console.log("No");console.log("Yes")}}]);
//  [javascript]
const input = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");

const N = input[0].split(' ').map(item => parseInt(item))[0]
input.shift()
input.pop()

AB = input.map(item => item.split(' ').map(item2 => parseInt(item2)))
const A = AB.map(item => item[0])
const B = AB.map(item => item[1])

// console.log(AB)
AB = AB.sort((a, b) => a[1] - b[1])
// console.log(AB)

count = 0
for (let i = 0; i < N; i++) {
    count += AB[i][0]
    if (count > AB[i][1]) {
        console.log('No')
        return
    }
}
console.log('Yes')
//  [javascript]
const input = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");

const N = input[0].split(' ').map(item => parseInt(item))[0]
input.shift()
input.pop()

const AB = input.map(item => item.split(' ').map(item2 => parseInt(item2)))
const A = AB.map(item => item[0])
const B = AB.map(item => item[1])

count = 0
for (i = 0; i < N; i++) {
    min_index = 0
    // console.log(AB)
    AB.reduce((prev, current, index) => {
        // console.log(prev, current, index, min_index)
        if (prev[1] <= current[1]) {
            return prev
        } else {
            min_index = index
            return current
        }
    })
    count += AB[min_index][0]
    if (count > AB[min_index][1]) {
        console.log('No')
        return
    }
    AB.splice(min_index, 1)
}

console.log('Yes')
//  [go]
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	if resolve(parseProblem()) {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

func parseProblem() (int, []task) {
	n := scanInt(sc)
	result := make([]task, n)
	for i := 0; i < n; i++ {
		result[i] = task{
			take:  scanInt(sc),
			limit: scanInt(sc),
		}
	}
	return n, result
}

type task struct{ take, limit int }
type tasks []task

func (t tasks) Len() int {
	return len(t)
}

func (t tasks) Less(i, j int) bool {
	return t[i].limit < t[j].limit
}

func (t tasks) Swap(i, j int) {
	t[i], t[j] = t[j], t[i]
}

func resolve(n int, ts []task) bool {
	sort.Sort(tasks(ts))
	sum := 0
	for _, t := range ts {
		sum += t.take
		if t.limit < sum {
			return false
		}
	}
	return true
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}
//  [ruby]
sa = 0
puts gets.to_i.times.map{
	gets.split.map(&:to_i)
}.sort_by{|_,b| b }.all?{|a,b|
	sa += a
	sa <= b
}?'Yes':'No'
//  [ruby]
n=gets.to_i
all=[]
n.times.each do
    v=gets.split.map(&:to_i)
    all<<v

end
all=all.sort_by{|_,v|v}
count=0
for i in 0..all.length-1
    count+=all[i][0]
    if count<=all[i][1]
        next
    else
        puts "No"
        exit

    end
end
puts "Yes"
//  [ruby]
n = gets.to_i
a = Array.new(n){gets.split.map(&:to_i)}.sort_by{|x, y| y}
sum = 0
a.each do |x, y|
  sum += x
  if sum > y
    puts 'No'
    exit
  end
end
puts 'Yes'
//  [ruby]
n = gets.to_i
tasks = []
n.times do
  a, b = gets.split.map(&:to_i).sort
  tasks << [b,a]
end
now = 0
tasks.sort.each do |t|
  now += t[1]
  if now > t[0]
    puts 'No'
    exit
  end
end
puts 'Yes'
//  [ruby]
n=gets.to_i
j=[]
n.times do
  a,b=gets.split.map(&:to_i)
  j << [a,b]
end
j.sort!{|j1,j2|j1[1]<=>j2[1]}
sum=0
for i in 0...n do
  sum+=j[i][0]
  if sum>j[i][1]
    puts "No"
    return 
  end
end
puts"Yes"
//  [ruby]
inputs=$stdin.read.split("\n")
ab =inputs[1..-1].map{|x| x.split(/\s/).map(&:to_i)}
sum=0
ab.sort! {|x,y| x[1]==y[1] ? x[0] <=>y[0] : x[1] <=> y[1] }
ab.each do |(a,b)|
 sum+=a
 if sum > b
   puts "No"
   return
 end
end