Deadline
Contest: Educational Codeforces Round 80 (Rated for Div. 2)
Difficulty rating: 1100
Tags: binary search, brute force, math, ternary search

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?

Input format:
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.

Output format:
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.

Constraints:
Time limit: 2.0 s
Memory limit: 256.0 MB

Note:
In 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.

Example input:
3
1 1
4 5
5 11

Example output:
YES
YES
NO

Editorial:
At first, let's note that if $$$x$$$ is integer and $$$x$$$ and $$$y$$$ are non-negative then $$$x + \left\lceil y \right\rceil = \left\lceil x + y \right\rceil$$$. So, instead of looking at $$$x + \left\lceil \frac{d}{x + 1} \right\rceil$$$ we can consider $$$\left\lceil x + \frac{d}{x + 1} \right\rceil$$$.
It's easier since the function $$$x + \frac{d}{x + 1} = (x + 1) + \frac{d}{(x + 1)} - 1$$$ is more common function and it can be proven that it's concave upward. It means that this function has a unique minimum and, moreover, we can calculate it: $$$f(x) = x + \frac{d}{x + 1}$$$ has minimum value in $$$x_0 = \sqrt{d} - 1$$$ and $$$f(x_0) = 2 \sqrt{d} - 1$$$.
Since the ceiling function is monotonically increasing so we can assume that $$$\left\lceil f(x) \right\rceil \le \left\lceil f(x + 1) \right\rceil$$$ for all $$$x \ge \sqrt{d}$$$.
So we can just iterate $$$x$$$ from $$$0$$$ to $$$\left\lfloor \sqrt{d} \right\rfloor$$$ and check the unequation $$$\left\lceil f(x) \right\rceil \le n$$$. The total complexity is equal to $$$O(T \sqrt{d})$$$.
There is a simple optimization: because of the monotone ceiling we can prove that we need to check only $$$\left\lfloor \sqrt{d} - 1 \right\rfloor$$$ and $$$\left\lceil \sqrt{d} - 1 \right\rceil$$$.