Adilbek was assigned to a special project. For Adilbek it means that he has $$$n$$$ days to run a special program and provide its results. But there is a problem: the program needs to run for $$$d$$$ days to calculate the results.Fortunately, Adilbek can optimize the program. If he spends $$$x$$$ ($$$x$$$ is a non-negative integer) days optimizing the program, he will make the program run in $$$\left\lceil \frac{d}{x + 1} \right\rceil$$$ days ($$$\left\lceil a \right\rceil$$$ is the ceiling function: $$$\left\lceil 2.4 \right\rceil = 3$$$, $$$\left\lceil 2 \right\rceil = 2$$$). The program cannot be run and optimized simultaneously, so the total number of days he will spend is equal to $$$x + \left\lceil \frac{d}{x + 1} \right\rceil$$$.Will Adilbek be able to provide the generated results in no more than $$$n$$$ days?

The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of test cases. The next $$$T$$$ lines contain test cases – one per line. Each line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le n \le 10^9$$$, $$$1 \le d \le 10^9$$$) — the number of days before the deadline and the number of days the program runs.

Print $$$T$$$ answers — one per test case. For each test case print YES (case insensitive) if Adilbek can fit in $$$n$$$ days or NO (case insensitive) otherwise.

NoteIn the first test case, Adilbek decides not to optimize the program at all, since $$$d \le n$$$.In the second test case, Adilbek can spend $$$1$$$ day optimizing the program and it will run $$$\left\lceil \frac{5}{2} \right\rceil = 3$$$ days. In total, he will spend $$$4$$$ days and will fit in the limit.In the third test case, it's impossible to fit in the limit. For example, if Adilbek will optimize the program $$$2$$$ days, it'll still work $$$\left\lceil \frac{11}{2+1} \right\rceil = 4$$$ days.

var t = readline();
var a = [];
var i = 0;
while (i < t) {
    a = readline().split(" ").map((a) => parseInt(a));
    var ans = 0;
    for (var j = 0; j < a[0]; j++) {
        ans = j + Math.ceil(a[1]/(j+1))
        if (ans <= a[0]) {
            print('YES');
            break;
        }
    }
    if (ans > a[0]) print("NO");
    i++;
}

var t = parseInt(readline(), 10),
    n = [],
    time = 0,
    mid1 = 0,
    mid2 = 0;

for(var i=1; i<=t; i++) {
    n = readline().split(' ').map(el => parseInt(el, 10));

    if(n[0] >= n[1]) print('YES');
    else {
        mid1 = Math.ceil(n[0]/2);
        mid2 = Math.floor(n[0]/2);
        time = (mid1 + Math.ceil(n[1]/(mid1+1))) < (mid2 + Math.ceil(n[1]/(mid2+1))) ? mid1 + Math.ceil(n[1]/(mid1+1)) : mid2 + Math.ceil(n[1]/(mid2+1));
        print(time <= n[0] ? 'YES' : 'NO');
    }
}

var T = parseInt(readline());

var n, d, result, y;

for (var i = 0; i < T; i++) {

  y = readline().split(" ").map(x => parseInt(x));

  n = y[0];
  d = y[1];

  if (n >= d) {
    print("YES");
    continue;
  }

  var pass = false;

  for (var x = 1; x <= n; x++) {
    result = Math.ceil(d/(x+1)) + x;

    if (result <= n) {
        print("YES");
        pass = true;
        break;
    }
  }

  if (!pass) print('NO');
}

var inputString = '';
var currentLine = 0;

process.stdin.on('data', function(inputStdin) {
    inputString += inputStdin;
});

process.stdin.on('end', function() {
    inputString = inputString.split('\n');
    main();
});

function readLine() {
    return inputString[currentLine++];
}

function main() {
    const t = Number(readLine());
    for (var i = 0; i < t; i++){
        const [n, d] = readLine().split(' ').map(Number);
        let mn = 1000000009;
        for (var x = 0; x <= Math.min(d, 40000); x++){
            mn = Math.min(mn, (x + Math.ceil(d/(x+1))));
        }
        console.log(mn <= n ? "YES": "NO");
    }
}

// Q: https://codeforces.com/contest/1288/problem/A

const readline = require('readline');

let input = [];

const rl = readline.createInterface({
	input: process.stdin,
	output: process.stdout,
});

rl.on('line', lineInput => {
	input.push(lineInput);
});

rl.on('close', () => {
	const test = parseInt(input[0]);
	for (let t=0; t < test; t++) {
		let inputData = input[t+1].split(' ').map((a) => {return parseInt(a)});
		console.log(solution(inputData[0], inputData[1]));
	}
});

function solution(n, d) {
	for (let j = 0; j < n; j++) {
		if (j + Math.ceil(d/(j+1)) <= n) {
			return 'YES';
		}
	}
	return 'NO';
}

process.stdin.resume()
process.stdin.setEncoding('utf-8')

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))

  const t = readInt(arr)

  for(let i = 0; i < t; i++) {
    const [n, d] = readInts(arr, i)

    let x = Math.sqrt(d)
    let x1 = Math.floor(x)
    let x2 = x1 - 1
    let x3 = x2 - 1
    // wr(x1, x2)
    if(d <= n || (x1 + Math.ceil(d / (x1 + 1)) <= n) || (x2 + Math.ceil(d / (x2 + 1)) <= n) || (x3 + Math.ceil(d / (x3 + 1)) <= n)) wr('YES')
    else wr('NO')
  }
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if(inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt(a, i) {
  if(i === undefined) return parseInt(a.shift())
  else return parseInt(a[i])
}
function readInts(a, i) {
  if(i === undefined) return arr.shift().split(' ').map(a => parseInt(a))
  else return arr[i].split(' ').map(a => parseInt(a))
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function main() {
    var T = Number(readline());
    var n, d, j;
    for (let i = 0; i < T; i++) {
        var line = readline().split(' ');
        n = parseInt(line[0]);
        d = parseInt(line[1]);
        for (j = 0; j < n; j++)
            if (j + Math.ceil(d / (j + 1)) <= n) {
                console.log("YES");
                break;
            }
        if (j === n)
            console.log("NO");
    }
    return 0;
}

const calc = (d, x) => Math.ceil( d / (x + 1) + x)

const processData = (lines) => {
  const num = +lines[0]

  for (let j=1; j<=num; j++){
    const [n, d] = lines[j].split(' ').map(x => +x)
    const extremum = Math.round(Math.sqrt(d) - 1)
    const minPoint = calc(d, extremum)
    if (minPoint <=  n && extremum <= n) {
      console.log('YES')
    } else {
      console.log('NO')
    }
  }
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})

let input = ''
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = input.split(EOL);
  main(lines);
});

function main(lines) {
  lines.pop();
  lines.shift();
  const tests = lines
    .map(t => t.split(' ').map(v => +v));
  for (const [n, d] of tests) {
    solve(n, d);
  }
}

function solve(n, d) {
  for (let x = 0; x <= n; x++) {
    const f = x + Math.ceil(d / (x + 1));
    if (f <= n) {
      console.log("YES");
      return;
    }
  }
  console.log("NO");
}

// main(["3", "1 1", "4 5", "5 11"])

var T = parseInt(readline());

print(T);

var n, d, result, y;

for (var i = 0; i < T; i++) {

  y = readline().split(" ").map(x => parseInt(x));

  n = y[0];
  d = y[1];

  if (n >= d) {
    print("YES");
    continue;
  }

  result = Math.ceil(d / 2);

  if (result <= n) {
    print("YES");
  } else {
    print("NO");
  }
}

var T = parseInt(readline());

print(T);

var n, d, result, y;

for (var i = 0; i < T; i++) {

  y = readline().split(" ").map(x => parseInt(x));

  n = y[0];
  d = y[1];

  if (n >= d) {
    print("YES");
    continue;
  }

  result = Math.ceil(d / 2) + 1;

  if (result <= n) {
    print("YES");
  } else {
    print("NO");
  }
}

var T = parseInt(readline());

var n, d, result, y;

for (var i = 0; i < T; i++) {

  y = readline().split(" ").map(x => parseInt(x));

  n = y[0];
  d = y[1];

  if (n >= d) {
    print("YES");
    continue;
  }

  result = Math.ceil(d / 2);

  if (result <= n) {
    print("YES");
  } else {
    print("NO");
  }
}

var T = parseInt(readline());

var n, d, result, y;

for (var i = 0; i < T; i++) {

  y = readline().split(" ").map(x => parseInt(x));

  n = y[0];
  d = y[1];

  if (n >= d) {
    print("YES");
    continue;
  }

  var pass = false;

  for (var x = 1; x <= n; x++) {
    result = Math.ceil(d/(x+1));

    if (result <= n) {
        print("YES");
        pass = true;
        break;
    }
  }
  if (!pass) print('NO');
}

var T = parseInt(readline());

var n, d, result, y;

for (var i = 0; i < T; i++) {

  y = readline().split(" ").map(x => parseInt(x));

  n = y[0];
  d = y[1];

  if (n >= d) {
    print("YES");
    continue;
  }

  result = Math.ceil(d / 2) + 1;

  if (result <= n) {
    print("YES");
  } else {
    print("NO");
  }
}

process.stdin.resume()
process.stdin.setEncoding('utf-8')

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))

  const t = readInt(arr)

  for(let i = 0; i < t; i++) {
    const [n, d] = readInts(arr, i)

    let x = Math.sqrt(d)
    let x1 = Math.ceil(x)
    let x2 = Math.floor(x)
    if(d <= n || (x1 + Math.ceil(d / (x1 + 1)) <= n) || (x2 + Math.ceil(d / (x2 + 1)) <= n)) wr('YES')
    else wr('NO')
  }
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if(inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt(a, i) {
  if(i === undefined) return parseInt(a.shift())
  else return parseInt(a[i])
}
function readInts(a, i) {
  if(i === undefined) return arr.shift().split(' ').map(a => parseInt(a))
  else return arr[i].split(' ').map(a => parseInt(a))
}

let input = ''
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => {
    const { EOL } = require('os');
    const lines = input.split(EOL);
    main(lines);
});

function main(lines) {
  const tests = lines.slice(1).map(t => t.split(' ').map(v => +v));
  for (const [n, d] of tests) {
    solve(n, d);
  }
}

function solve(n, d) {
  for (let x = 0; x <= n; x++) {
    const f = x + Math.ceil(d / (x + 1));
    if (f <= n) {
      console.log("YES");
      return;
    }
  }
  console.log("NO");
}

// main(["3", "1 1", "4 5", "5 11"])

let input = ''
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => {
    const { EOL } = require('os');
    const lines = input.split(EOL);
    lines.forEach((l) => console.log(l + '\\\\'));
    main(lines);
});

function main(lines) {
  const tests = lines.slice(1).map(t => t.split(' ').map(v => +v));
  for (const [n, d] of tests) {
    solve(n, d);
  }
}

function solve(n, d) {
  for (let x = 0; x <= n; x++) {
    const f = x + Math.ceil(d / (x + 1));
    if (f <= n) {
      console.log("YES");
      return;
    }
  }
  console.log("NO");
}

// main(["3", "1 1", "4 5", "5 11"])

let input = ''
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => {
    const { EOL } = require('os');
    const lines = input.split(EOL);
    main(lines);
});

function main(lines) {
  const n = +lines[0];
  const tests = lines.slice(1).map(t => t.split(' ').map(v => +v));
  for (const [n, d] of tests) {
    solve(n, d);
  }
}

function solve(n, d) {
  for (let x = 0; x <= n; x++) {
    const f = x + Math.ceil(d / (x + 1));
    if (f <= n) {
      console.log("YES");
      return;
    }
  }
  console.log("NO");
}

// main(["3", "1 1", "4 5", "5 11"])

var t = readline();
var a = [];
var i = 0;
var x;
var d;
while (i < t) {
  a = readline()
    .split(" ")
    .map((a) => parseInt(a));
    // print("math",Math.ceil(a[1]/a[0]))

  x = Math.ceil(a[1] / a[0]) - 1;
  d=x+1
//   print("d",d)
  if (x+Math.ceil(a[1]/d)<=a[0])
  print("YES");
  else print("NO");
//   print("nf",x+Math.ceil(a[1]/d))
//   print("n",a[0])
//   print("d",a[1])
  i++;
}

var t = readline();
var a = [];
var i = 0;
var x;
var d;
while (i < t) {
  a = readline()
    .split(" ")
    .map((a) => parseInt(a));
    print("math",Math.ceil(a[1]/a[0]))

  x = Math.ceil(a[1] / a[0]) - 1;
  d=x+1
//   print("d",d)
  if (x+Math.ceil(a[1]/d)<=a[0])
  print("YES");
  else print("NO");
//   print("nf",x+Math.ceil(a[1]/d))
//   print("n",a[0])
//   print("d",a[1])
  i++;
}

var t = readline();
var a = [];
var i = 0;
var x;
var d;
while (i < t) {
  a = readline()
    .split(" ")
    .map((a) => parseInt(a));
    // print("math",Math.ceil(a[1]/a[0]))

  x = Math.ceil(a[1] / a[0]) - 1;
  d=x+1
//   print("d",d)
  if (x+a[0]<=a[0])
  print("YES");
  else print("NO");
//   print("nf",x+Math.ceil(a[1]/d))
//   print("n",a[0])
//   print("d",a[1])
  i++;
}


Our beloved detective, Sherlock is currently trying to catch a serial killer who kills a person each day. Using his powers of deduction, he came to know that the killer has a strategy for selecting his next victim.The killer starts with two potential victims on his first day, selects one of these two, kills selected victim and replaces him with a new person. He repeats this procedure each day. This way, each day he has two potential victims to choose from. Sherlock knows the initial two potential victims. Also, he knows the murder that happened on a particular day and the new person who replaced this victim.You need to help him get all the pairs of potential victims at each day so that Sherlock can observe some pattern.

NoteIn first example, the killer starts with ross and rachel.   After day 1, ross is killed and joey appears.  After day 2, rachel is killed and phoebe appears.  After day 3, phoebe is killed and monica appears.  After day 4, monica is killed and chandler appears.

var h = readline().split(' ');
var n = parseInt(readline());
var story = [];

story.push(h.join(' '));

for(var i = 0; i < n; i++){
   var v = readline().split(' ');
   var ind = h.indexOf(v[0]);
   h[ind] = v[1];
   story.push(h.join(' '));
}

print(story.join('\n'));

var potential_victims = readline().split(' ');
var n = parseInt(readline());
var tmp_answer = [];

tmp_answer.push(potential_victims.join(' ')); // push initial potential victims

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

    var substitute = readline().split(' ');
    var dead_index = potential_victims.indexOf(substitute[0]);

    potential_victims[dead_index] = substitute[1];
    tmp_answer.push(potential_victims.join(' '));
}

print(tmp_answer.join('\n'));

var input = readline().split(" ");
var n = parseInt(readline());

print(input[0] + ' ' + input[1]);

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

	var next = readline().split(" ");

	var j = next.indexOf(input[0]) === -1 ? 1 : 0;
	var k = next.indexOf(input[j]);

	print(input[(j + 1) % 2] + ' ' + next[(k + 1) % 2]);
	input[j] = next[(k + 1) % 2];
}

/**
 *
Our beloved detective, Sherlock is currently trying to catch a serial killer who kills a person each day.
 Using his powers of deduction, he came to know that the killer has a strategy for selecting his next victim.

The killer starts with two potential victims on his first day, selects one of these two,
kills selected victim and replaces him with a new person. He repeats this procedure each day.
This way, each day he has two potential victims to choose from. Sherlock knows the initial two potential victims.
Also, he knows the murder that happened on a particular day and the new person who replaced this victim.

You need to help him get all the pairs of potential victims at each day so that Sherlock can observe some pattern.

Input
First line of input contains two names (length of each of them doesn't exceed 10), the two initials potential victims.
Next line contains integer n (1 ≤ n ≤ 1000), the number of days.

Next n lines contains two names (length of each of them doesn't exceed 10), first being the person murdered on this day
and the second being the one who replaced that person.

The input format is consistent, that is, a person murdered is guaranteed to be from the two potential victims at that time.
Also, all the names are guaranteed to be distinct and consists of lowercase English letters.

Output
Output n + 1 lines, the i-th line should contain the two persons from which the killer selects for the i-th murder.
The (n + 1)-th line should contain the two persons from which the next victim is selected. In each line,
the two names can be printed in any order.

input
ross rachel
4
ross joey
rachel phoebe
phoebe monica
monica chandler

output
ross rachel
joey rachel
joey phoebe
joey monica
joey chandler

input
icm codeforces
1
codeforces technex

output
icm codeforces
icm technex

 */

let inputString = '';

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    let initialVictims = inputString[0]
    let numberOfDays = Number(inputString[1]);
    let victims = inputString.slice(2)

    solution(initialVictims, numberOfDays, victims);

});

function solution(initialVictims, numberOfDays, victims) {

    let initialVictimOne = initialVictims.split(" ")[0]
    let initialVictimTwo = initialVictims.split(" ")[1]
    let solutionArray = [];
    //console.log(initialVictimOne , initialVictimTwo);
    solutionArray.push(initialVictimOne);
    solutionArray.push(" ");
    solutionArray.push(initialVictimTwo);
    solutionArray.push("\n");

    for (let index = 0; index < numberOfDays; index++) {

        let element = victims[index];
        let vicitimOne = element.split(" ")[0];
        let vicitimTwo = element.split(" ")[1];

        if (vicitimOne == initialVictimOne) {
            solutionArray.push(initialVictimTwo);
            solutionArray.push(" ");
            initialVictimOne = initialVictimTwo;
            initialVictimTwo = vicitimTwo;

        }

        if (vicitimOne == initialVictimTwo) {
            solutionArray.push(initialVictimOne);
            solutionArray.push(" ");
            initialVictimTwo = initialVictimOne;
            initialVictimOne = vicitimTwo;
        }

        solutionArray.push(vicitimTwo);
        solutionArray.push("\n");
    }

    console.log(solutionArray.join(""));

}


You are policeman and you are playing a game with Slavik. The game is turn-based and each turn consists of two phases. During the first phase you make your move and during the second phase Slavik makes his move.There are $$$n$$$ doors, the $$$i$$$-th door initially has durability equal to $$$a_i$$$.During your move you can try to break one of the doors. If you choose door $$$i$$$ and its current durability is $$$b_i$$$ then you reduce its durability to $$$max(0, b_i - x)$$$ (the value $$$x$$$ is given).During Slavik's move he tries to repair one of the doors. If he chooses door $$$i$$$ and its current durability is $$$b_i$$$ then he increases its durability to $$$b_i + y$$$ (the value $$$y$$$ is given). Slavik cannot repair doors with current durability equal to $$$0$$$.The game lasts $$$10^{100}$$$ turns. If some player cannot make his move then he has to skip it.Your goal is to maximize the number of doors with durability equal to $$$0$$$ at the end of the game. You can assume that Slavik wants to minimize the number of such doors. What is the number of such doors in the end if you both play optimally?

The first line of the input contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 100$$$, $$$1 \le x, y \le 10^5$$$) — the number of doors, value $$$x$$$ and value $$$y$$$, respectively. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^5$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th door.

Print one integer — the number of doors with durability equal to $$$0$$$ at the end of the game, if you and Slavik both play optimally.

NoteClarifications about the optimal strategy will be ignored.

function main(r) {
    var n = r().split(' ');
    var x = +n[1], y = +n[2];
    n = +n[0];

    var a =r().split(' ');

    if(x > y) {
        print(a.length);
        return;
    }
    var c = a.filter(function(i){
        return x >= +i
    }).length;

    print(Math.ceil(c / 2));

}

main(readline);

function calc(n, x, y, a) {
  if (x <= y) {
    return Math.ceil(a.filter(elem => elem <= x).length / 2);
  }

  if (x > y) {
    return n;
  }
}

var nxy = readline().split(" ");
var n = parseInt(nxy[0]);
var x = parseInt(nxy[1]);
var y = parseInt(nxy[2]);

var a = readline().split(" ").map(elem => parseInt(elem));

print(calc(n, x, y, a));

var nxy = readline().split(' ').map(a => +a);
n = nxy[0];
x = nxy[1];
y = nxy[2];

var a = readline().split(' ').map(a => +a);

if (x > y)
	print (n);
else {
	var kol = 0;
	a.forEach(function(number){
		if (number <= x) kol++;
	});

	print (Math.ceil(kol/2));
}

var tmp = readline().split(' ').map(Number);
var n = tmp[0];
var x = tmp[1];
var y = tmp[2];

var arr = readline().split(' ').map(Number);

var cnt = 0;

arr.forEach( i => {
    if( i <= x ) {
        cnt++;
    }
});
if( x <= y ) {
    print(Math.ceil(cnt/2));

} else print( n );

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let x =0
let y= 0
let n =0
rl.on('line', (input) => {
    if (l === 0) {
        let arr = input.split(" ").map(x=>parseInt(x))
        x = arr[1]
        y = arr[2]
    } else {
        rl.close();
        let arr = input.split(" ").map(p=>parseInt(p))
        if(x>y){
          console.log(arr.length)
           return
        }
        let c=0
        for(let i=0;i<arr.length;i++){
        if(arr[i]<=x){
            c++;
        }
        }
        console.log(Math.ceil(c/2)+"")
        return
    }
    l++
})

function main(r) {
    var n = r().split(' ');
    var x = n[1], y = n[2];
    n = n[0];

    var a =r().split(' ');

    if(x > y) {
        print(a.length);
        return;
    }

    var c = a.filter(function(i){
        return i < x;
    }).length;

    print(Math.ceil(c / 2));
}

main(readline)

function main(r) {
    var n = r().split(' ');
    var x = +n[1], y = +n[2];
    n = +n[0];

    var a =r().split(' ');

    if(x > y) {
        print(a.length);
        return;
    }

    var c = a.filter(function(i){
        return +i < x;
    }).length;

    print(Math.ceil(c / 2));
}

main(readline);

function main(r) {
    var n = r().split(' ');
    var x = n[1], y = n[2];
    n = n[0];

    var a =r().split(' ');

    if(x > y) {
        print(a.length);
        return;
    }

    var c = a.filter(function(i){
        return i <= x;
    }).length;

    print(Math.ceil(c / 2));
}

main(readline)

function calc(n, x, y, a) {
  if (x <= y) {
    return Math.ceil(a.filter(elem => elem <= x).length / 2);
  }

  if (x > y) {
    return n;
  }
}

var nxy = readline().split(" ");
var n = nxy[0];
var x = nxy[1];
var y = nxy[2];

var a = readline().split(" ");

print(calc(n, x, y, a));

function calc(n, x, y, a) {
  if (x <= y) {
    return Math.ceil(a.filter(elem => elem <= x).length / 2);
  }

  if (x > y) {
    return n;
  }
}

var nxy = readline().split(" ");
var n = nxy[0];
var x = nxy[1];
var y = nxy[2];

var a = readline().split(" ").map(elem => parseInt(elem));

print(calc(n, x, y, a));

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let x =0
let y= 0
let n =0
rl.on('line', (input) => {
    if (l === 0) {
        let arr = input.split(" ").map(x=>parseInt(x))
        x = arr[1]
        y = arr[2]
    } else {
        rl.close();
        let arr = input.split(" ").map(p=>parseInt(p))
        if(x>y){
           return
        }
        let c=0
        for(let i=0;i<arr.length;i++){
        if(arr[i]<=x){
            c++;
        }
        }
        console.log(Math.ceil(c/2))
    }
    l++
})

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let x =0
let y= 0
let n =0
rl.on('line', (input) => {
    if (l === 0) {
        let arr = input.split(" ").map(x=>parseInt(x))
        x = arr[1]
        y = arr[2]
    } else {
        rl.close();
        let arr = input.split(" ").map(p=>parseInt(p))
        if(x>y){
           return
        }
        let c=0
        for(let i=0;i<arr.length;i++){
        if(arr[i]<=x){
            c++;
        }
        }
        console.log(Math.ceil(c/2)+"")
    }
    l++
})


In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the Kingdom healers had already had three appointments with the merchants who were asked to sell, say, exactly 0.273549107 beer barrels. To deal with the problem somehow, the King issued an order obliging rounding up all numbers to the closest integer to simplify calculations. Specifically, the order went like this: If a number's integer part does not end with digit 9 and its fractional part is strictly less than 0.5, then the rounded up number coincides with the number’s integer part.  If a number's integer part does not end with digit 9 and its fractional part is not less than 0.5, the rounded up number is obtained if we add 1 to the last digit of the number’s integer part. If the number’s integer part ends with digit 9, to round up the numbers one should go to Vasilisa the Wise. In the whole Kingdom she is the only one who can perform the tricky operation of carrying into the next position. Merchants found the algorithm very sophisticated and they asked you (the ACMers) to help them. Can you write a program that would perform the rounding according to the King’s order?

The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empty set of decimal digits). The number's length does not exceed 1000 characters, including the dot. There are no other characters in the input data.

If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes).

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

rl.on('line', (str) => {
  const dotIdx = str.indexOf('.');

  if (str[dotIdx - 1] === '9') {
    console.log('GOTO Vasilisa.');
  }
  else if (+str[dotIdx + 1] < 5) {
    console.log(str.split('.')[0]);
  }
  else {
    const [a, b] = str.split('.');

    console.log((BigInt(a) + 1n).toString());
  }
});

var inpStr = readline();

var i=0, l = inpStr.length, n = 0, flag = 0, outStr="";

for(i=0; i<l; i++)
{
  if(inpStr[i] == "." && flag == 0)
  {
    n = i;

    if(inpStr[i-1]=="9")
    {
      flag = 3; // GoTo
    }
    else if(inpStr[i+1]<"5")
    {
      flag = 2; // down
    }
    else
    {
      flag = 1; // up
    }
  }
}

if(flag == 3)
{
  outStr = "GOTO Vasilisa.";
}

if(flag == 2)
{
  outStr = inpStr.slice(0,n);
}

if(flag == 1)
{
  var s = inpStr[n-1], sn = s.charCodeAt(0), ss = String.fromCharCode(sn+1);

  outStr = inpStr.slice(0,n-1);
  outStr = outStr + ss;
}

print(outStr);

var input = readline().split('.'), main = input[0], rest = input[1];
if (main[main.length-1] == '9') write('GOTO Vasilisa.');
else if (rest[0] < 5) write(main);
else if (rest[0] >= 5) {
    var mainArr = main.split('');
    mainArr[main.length - 1] = parseInt(mainArr[main.length - 1]) + 1;
    write(mainArr.join(''));
}

(function main() {
    var l = readline();
    if (l.match(/9\./)) {
        print('GOTO Vasilisa.');
    } else {
        l = l.replace(/([0-8])\.([0-9]).*$/,
                function(str, p1, p2, offset, s) {
                    if (p2.match(/[0-4]/))
                        return p1;
                    else
                        return String.fromCharCode(p1.charCodeAt(0) + 1);
                });
        print(l);
    }
})();

var inpStr = readline();

var i=0, l = inpStr.length, n = 0, flag = 0, outStr="";

for(i=0; i<l; i++)
{
  if(inpStr[i] == "." && flag == 0)
  {
    n = i;

    if(inpStr[i-1]=="9")
    {
      flag = 3; // GoTo
    }
    else if(inpStr[i+1]<"5")
    {
      flag = 2; // down
    }
    else
    {
      flag = 1; // up
    }
  }
}

if(flag == 3)
{
  outStr = "GOTO Vasilisa.";
}

if(flag == 2)
{
  outStr = inpStr.slice(0,n);
}

if(flag == 1)
{
  outStr = inpStr.slice(0,n);
  outStr = outStr + (inpStr[n+1]+1);
}

print(outStr);

var inpStr = readline();

var i=0, l = inpStr.length, n = 0, flag = 0, outStr="";

for(i=0; i<l; i++)
{
  if(inpStr[i] == "." && flag == 0)
  {
    n = i;

    if(inpStr[i-1]=="9")
    {
      flag = 3; // GoTo
    }
    else if(inpStr[i+1]<"5")
    {
      flag = 2; // down
    }
    else
    {
      flag = 1; // up
    }
  }
}

if(flag == 3)
{
  outStr = "GOTO Vasilisa.";
}

if(flag == 2)
{
  outStr = inpStr.slice(0,n);
}

if(flag == 1)
{
  var s = inpStr[n-1], sn = s.charCodeAt(0), ss = String.fromCharCode(sn+1);

  outStr = inpStr.slice(0,n);
  outStr = outStr + ss;
}

print(outStr);


Did you know you can download more RAM? There is a shop with $$$n$$$ different pieces of software that increase your RAM. The $$$i$$$-th RAM increasing software takes $$$a_i$$$ GB of memory to run (temporarily, once the program is done running, you get the RAM back), and gives you an additional $$$b_i$$$ GB of RAM (permanently). Each software can only be used once. Your PC currently has $$$k$$$ GB of RAM.Note that you can't use a RAM-increasing software if it takes more GB of RAM to use than what you currently have.Since RAM is the most important thing in the world, you wonder, what is the maximum possible amount of RAM achievable?

The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains the integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 100$$$, $$$1 \le k \le 1000$$$). Then two lines follow, each containing $$$n$$$ integers describing the arrays $$$a$$$ and $$$b$$$ ($$$1 \le a_i, b_i \le 1000$$$).

For each test case, output a single line containing the largest amount of RAM you can achieve.

NoteIn the first test case, you only have enough RAM to run the third software initially, but that increases your RAM to $$$20$$$ GB, which allows you to use the first software, increasing your RAM to $$$29$$$ GB. The only software left needs $$$30$$$ GB of RAM, so you have to stop here.In the second test case, you can use the first, second, fourth and fifth software that need only $$$1$$$ GB of RAM per software to run to increase your RAM to $$$5$$$ GB, and then use the last remaining one to increase your RAM to $$$6$$$ GB.In the third test case, all the software need more than $$$1$$$ GB of RAM to run, so the amount of RAM you have stays at $$$1$$$ GB.

let _inputLines;
let _lineNumber = 0;
let inputReader = _inputReader ();

function _main() {

	_inputLines = _inputData.trim().split('\n').map((string) => {
		return string.trim();
	});;
	let j = inputReader.readNumber();
	while (j--) {
	  let [n, k] = inputReader.readNumberArray();
	  let a = [];
	  let b = inputReader.readNumberArray();
	  for (let i = 0; i < n; i++)
	    a[i] = { ff: b[i] };
	  b = inputReader.readNumberArray();
	  for (let i = 0; i < n; i++)
	    a[i].ss = b[i];
	  a.sort((a, b) => a.ff - b.ff);
	  for (let i = 0; i < n; i++)
	    if (a[i].ff <= k) k += a[i].ss;
	  console.log(k);
	}

}

var _inputData = '';
function cacheInput(data) {
	_inputData += data;
}

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', cacheInput).on('end', _main);

function _inputReader () {
	function readNumber(){
		return Number(_inputLines[_lineNumber++]);
	}

	function readNumberArray(){
		return _inputLines[_lineNumber++].split(' ').map(val => Number(val));
	}

	return {
		readNumber,
		readNumberArray,
	}
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', stdin => inputString += stdin);

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(s => s.trim());
    main();
});

function readline() {
    return inputString[currentLine++];
}

function output(x) {
    if (typeof x !== 'string') {
        x = x.toString();
    }
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

function main() {
    let N = readline();

    for (let test = 0; test < N; test++) {
        let [n, k] = readline().split(' ').map(Number);
        let arr = readline().split(' ').map(Number);
        let brr = readline().split(' ').map(Number);

        let shops = arr.map((v, i) => ({
            pay: arr[i],
            get: brr[i]
        }));

        shops.sort((a, b) => a.pay - b.pay);

        let i = 0;
        while (i < n) {
            if (shops[i].pay <= k) {
                k += shops[i].get;
            } else {
                break;
            }
            i++;
        }

        output(k);
    }
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = nextLong();
		}else if(code == 'double'){
			ret[i] = nextDouble();
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');} function nextDoubleArray(size){return nextArray(size, 'double');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());} function nextDouble(){return parseFloat(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var N = nextInt();
		var K = nextInt();
		var list = new Array(N);
		for(var i = 0; i < N; i++){
			list[i] = {
				A : nextInt(),
				B : 0
			};
		}
		for(var i = 0; i < N; i++){
			list[i].B = nextInt();
		}
		list.sort(function(a,b){
			return a.A - b.A;
		});
		for(var i = 0; i < N; i++){
			if(list[i].A <= K){
				K += list[i].B;
			}else{
				break;
			}
		}
		myout(K);
	}
}

let input = "";
process.stdin.on("data", (chunk) => {
  input += chunk;
});
process.stdin.on("end", (chunk) => {
  let lines = input.trim().split("\n");
  let t = parseInt(lines[0]);
  let i = 1;
  while (t--) {
    let [n, k] = lines[i++]
      .trim()
      .split(" ")
      .map((element) => parseInt(element));
    let a = lines[i++]
      .trim()
      .split(" ")
      .map((element) => parseInt(element));
    let b = lines[i++]
      .trim()
      .split(" ")
      .map((element) => parseInt(element));
    let software = [];
    for (let j = 0; j < n; j++) {
      software.push([a[j], b[j]]);
    }
    software.sort((a, b) => a[0] - b[0]);
    for (let j = 0; j < n; j++) {
      if (software[j][0] <= k) {
        k += software[j][1];
      }
    }
    console.log(k);
  }
});

let data = '';
process.stdin.on('data', c => data += c);

function* nextLine() {
	let lines = data.trim().split(/\n/g);
	for(let l of lines){
		yield l.trim();
	}
}

let nl = nextLine();

nl.elem = function(funParse) {
		return funParse(this.next().value);
	};

nl.array = function(funParse) {
		return this.next().value.split(/\s/g).map(funParse||(x => x));
	};

nl.num = function() {
		return nl.elem(Number);
	};

nl.nums = function() {
		return nl.array(Number);
	};

nl.line = function() {
		return this.next().value;
	};

const sol = () => {
	//your code this
	let t = nl.num();
	let ans = [];
	for(let i = 0; i < t; i++){
		let [n, k] = nl.nums();
		let a = nl.nums();
		let b = nl.nums();
		let ab = a.map((e, i) => [e, b[i]]);
		ab.sort((a, b) => a[0] - b[0]);
		for(let  j = 0; j < n && ab[j][0] <= k; j++){
			k += ab[j][1];
		}
		ans.push(k);
	}
	console.log(ans.join('\n'));
};

process.stdin.on('end', sol);

// Common Template Starts //
//*
process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});

process.stdin.on("end", (_) => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((string) => {
      return string.trim();
    });

  main();
});

function readline() {
  return inputString[currentLine++];
}
// Common Template Ends //

// LIBRARY START //

const isOdd = (x) => {
  return x & 1;
};
const isEven = (x) => {
  return !(x & 1);
};

const reverseText = (s) => {
  return s.split("").reverse().join("");
};
const hasDuplicates = (str) => /([a-z])\1/i.test(str);

const hasDuplicateChar = (str, char) =>
  str.indexOf(char) !== str.lastIndexOf(char);

const isSorted = (arr) => arr.every((v, i, a) => !i || a[i - 1] <= v);

const findAllIndicesOfChar = (str, char) => {
  str = str.split("");
  let indices = [];
  for (let i = 0; i < str.length; i++) {
    if (str[i] === char) indices.push(i);
  }
  return indices;
};

const splitAt = (index) => (x) => [x.slice(0, index), x.slice(index)];

const isUpper = (str) => !/[a-z]/.test(str) && /[A-Z]/.test(str);

const escapeRegExp = (string) =>
  string.replace(/[.*+\-?^$$${}()|[\]\\]/g, "$$$&");

const replaceAll = (str, find, replace) =>
  str.replace(new RegExp(escapeRegExp(find), "g"), replace);

const findUnique = (str) => {
  return [...str].reduce((acc, curr) => {
    return acc.includes(curr) ? acc : acc + curr;
  }, "");
};

const unique = (str) => {
  const cleanStr = str.replace(/ /gi, "");
  const set = [...new Set(cleanStr)];
  return set;
};

const sortASC = (array) => {
  // var numArray = new Uint32Array(array)
  // var numArray = new Int32Array(array)
  var numArray = new Float64Array(array);
  numArray = numArray.sort();
  return numArray;
};

const removeDuplicates = (array) => [...new Set(array)];

// LIBRARY END

function solve() {
  let [n, k] = readline().split(" ").map(Number);
  let ram = new Array(n);
  a = readline().split(" ").map(Number);
  b = readline().split(" ").map(Number);
  for (let i = 0; i < n; i++) {
    ram[i] = new Array(2);
    ram[i][0] = a[i];
    ram[i][1] = b[i];
  }
  ram.sort(function (a, b) {
    return a[0] - b[0];
  });
  for (let i = 0; i < n; i++) {
    if (ram[i][0] <= k) {
      k += ram[i][1];
    }
  }
  console.log(k);
}

function main() {
  let tc = +readline();
  while (tc--) {
    solve();
  }
}

const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trim().split('\n');
let currentline = 0;
function readline(){
    return input[currentline++];
}

var T = readline();
for(var q=1;q<=T;q++) {
            var [n,k] = readline().split(" ").map(w => parseInt(w))
            var a = readline().split(" ").map(w => parseInt(w))
            var b = readline().split(" ").map(w => parseInt(w))
            var nw = []
            for(var i=0;i<a.length;i++) {
            	var f = [a[i], b[i]]
            	nw.push(f)
            }
            nw.sort(function(ar,br) { return ar[0]-br[0] })
            var sum = k;
            for(var i=0;i<nw.length;i++) {
            	if(sum >= nw[i][0]) {
            		sum+= nw[i][1]
            	}
            }
            console.log(sum)
}

var total = +readline();
while (total--) {
    var RAM = +readline().split(" ")[1];
    var requireRams = readline().split(" ").map(function (x) {
        return +x;
    });
    var acquireRams = readline().split(" ").map(function (x) {
        return +x;
    });
    var rams = [];
    for (var i = 0; i < requireRams.length; i++) {
        rams.push({
            requireRams: requireRams[i],
            acquireRams: acquireRams[i]
        });
    }
    rams.sort(function (a, b) {
        return a.requireRams - b.requireRams;
    });
    var count = 0;
    while (count < rams.length && rams[count].requireRams <= RAM) {
        RAM += rams[count].acquireRams;
        count++;
    }
    print(RAM);
}

var t = +readline();

while(t--) {
  var line = readline().split(' ');
  var n = +line[0], k = +line[1];
  var arrA = readline().split(' ').map(function(n) { return +n; });
  var arrB = readline().split(' ').map(function(n) { return +n; });
  var arrAB = [];

  for (var i = 0; i < n; i++) {
    arrAB.push([arrA[i], arrB[i]]);
  }

  arrAB.sort(function(a, b) { return a[0] - b[0]; });

  var res = k;

  for (var i = 0; i < n; i++) {
    if (arrAB[i][0] <= res) {
      res += arrAB[i][1];
    }
  }

  print(res);
}

let _inputLines;
let _lineNumber = 0;
let inputReader = _inputReader ();

function _main() {

	_inputLines = _inputData.trim().split('\n').map((string) => {
		return string.trim();
	});;
	let n = inputReader.readNumber();
	while (n--) {
	  let [s1, ss] = inputReader.readNumberArray();
	  const used = {};
	  let a = new Array(s1);
	  for (let j = 0; j < 2; j++) {
	    let b = inputReader.readNumberArray();
	    a = a.concat(b);
	  }
	  while (true) {
	    let check = false;
	    for (let i = 0; i < a.length; i++) {
	      if (!used[i % s1] && ss >= a[i]) {
	        check = true;
	        used[i % s1] = true;
	        ss += a[i];
	      }
	    }
	    if (!check) break;
	  }
	}

}

var _inputData = '';
function cacheInput(data) {
	_inputData += data;
}

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', cacheInput).on('end', _main);

function _inputReader () {
	function readNumber(){
		return Number(_inputLines[_lineNumber++]);
	}

	function readNumberArray(){
		return _inputLines[_lineNumber++].split(' ').map(val => Number(val));
	}

	return {
		readNumber,
		readNumberArray,
	}
}

let _inputLines;
let _lineNumber = 0;
let inputReader = _inputReader ();

function _main() {

	_inputLines = _inputData.trim().split('\n').map((string) => {
		return string.trim();
	});;
	let n = inputReader.readNumber();
	while (n--) {
	  let [s1, ss] = inputReader.readNumberArray();
	  const used = {};
	  let a = new Array(s1);
	  for (let j = 0; j < 2; j++) {
	    let b = inputReader.readNumberArray();
	    a = a.concat(b);
	  }
	  while (true) {
	    let check = false;
	    for (let i = 0; i < a.length; i++) {
	      if (!used[i % s1] && ss >= a[i]) {
	        check = true;
	        used[i % s1] = true;
	        ss += a[i];
	      }
	    }
	    if (!check) break;
	  }
	  console.log(ss);
	}

}

var _inputData = '';
function cacheInput(data) {
	_inputData += data;
}

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', cacheInput).on('end', _main);

function _inputReader () {
	function readNumber(){
		return Number(_inputLines[_lineNumber++]);
	}

	function readNumberArray(){
		return _inputLines[_lineNumber++].split(' ').map(val => Number(val));
	}

	return {
		readNumber,
		readNumberArray,
	}
}