A permutation of length N is an array of N integers (P_{1},P_{2}, \dots,P_{N}) where every integer from 1 to N (inclusive) appears in it exactly once. The weight of a subsegment containing the elements (P_{l},P_{l+1}, \dots,P_{r}) is defined as follows:  W(l, r) = (r-l+1)\cdot \min\limits_{l≤ i ≤ r} (P_{i})
where 1≤ l ≤ r ≤ N and \min\limits_{l≤ i ≤ r} (P_{i}) denotes the minimum element of the subsegment.

You are given two integers N and X. You need to determine if there exists a permutation of length N such that it contains at least one subsegment having weight X?

------ Input Format ------ 

- The first line contains an integer T - the number of test cases. The T test cases then follow.
- The first and only line of each test case contains two space-separated integers N, X - the length of the permutation and the weight parameter mentioned in the question respectively.

------ Output Format ------ 

For each test case, print YES if there exists a permutation of length N having at least one subsegment with a weight of X, otherwise print NO.

You may print each character of Yes and No in uppercase or lowercase (for example, yes, yEs, YES will be considered identical).

------ Constraints ------ 

$1 ≤ T ≤ 10^{4}$
$1 ≤ N ≤ 10^{5}$
$1 ≤ X ≤ 10^{10}$
- Sum of $N$ over all test cases does not exceed $3 \cdot 10^{5}$.

----- Sample Input 1 ------ 
4
3 2
3 5
5 6
4 10

----- Sample Output 1 ------ 
YES
NO
YES
NO

----- explanation 1 ------ 
Test case $1$: $[1, 2, 3]$ is one of the valid permutations because it contains the following subsegment having weight $2$. 

$W(1, 2) = (2-1+1) \cdot \min\limits_{1≤ i ≤ 2} (P_{i})= 2 \cdot 1=2$ 

Test case $2$: It can be proven that there does not exist any permutation of length $3$ which has a subsegment having weight $5$.

Test case $3$: $[4, 2, 1, 3, 5]$ is one of the valid permutations because it contains the following subsegment having weight $6$.

$W(4, 5)=(5-4+1) \cdot \min\limits_{4≤ i ≤ 5} (P_{i})= 2 \cdot 3=6$

Difficulty: MEDIUM_HARD
Tags: Number theory

Mathematics

Starter code:

Solutions:
for i in range(int(input())):
	(n, x) = map(int, input().split())
	ff = 0
	for h in range(1, n + 1):
		if x % h == 0:
			if x // h <= n - h + 1:
				ff = 1
				break
	if ff == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	if n >= x:
		print('YES')
	else:
		ans = 0
		for i in range(1, n + 1):
			if x % i == 0:
				if n - i + 1 >= x / i:
					ans = 1
					break
		if ans:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	if n >= x:
		print('YES')
	else:
		a = n // 2 + 1
		b = (n - a + 1) * a
		if x > b:
			print('NO')
		else:
			contador = 0
			for i in range(1, n + 1):
				if x % i == 0:
					if n - i + 1 >= x / i:
						contador = 1
						break
			if contador:
				print('YES')
			else:
				print('NO')


for ____________ in range(int(input())):
	(N, X) = [int(x) for x in input().split()]
	respuesta = False
	if X <= N:
		respuesta = True
	else:
		for n in range(1, N + 1):
			if X % n == 0:
				if N - X / n >= n - 1:
					respuesta = True
	if respuesta:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	if n >= x:
		print('YES')
	else:
		ctr = n // 2 + 1
		y = (n - ctr + 1) * ctr
		if x > y:
			print('NO')
		else:
			cnt = 0
			for i in range(1, n + 1):
				if x % i == 0:
					if n - i + 1 >= x / i:
						cnt = 1
						break
			if cnt:
				print('YES')
			else:
				print('NO')


t = int(input())
while t > 0:
	flag = 0
	(n, x) = map(int, input().split())
	for i in range(1, n + 1):
		if x % i == 0:
			k = x / i
			if k <= n - i + 1:
				print('YES')
				flag = 1
				break
	if flag == 0:
		print('NO')
	t -= 1


tl = int(input())
while tl:
	tl -= 1
	a = list(map(int, input().split()))
	n = a[0]
	x = a[1]
	flag = 0
	for i in range(1, n + 1):
		if x % i == 0 and x // i <= n - i + 1:
			flag = 1
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	f = False
	for j in range(1, n + 1):
		if x % j == 0:
			b = x // j
			if b <= n - j + 1:
				f = True
	print('YES' if f == True else 'NO')


t = int(input())
while t != 0:
	t -= 1
	(n, x) = map(int, input().split(' '))
	flag = False
	for a in range(1, n + 1):
		if x % a == 0:
			b = x // a
			if b <= n - a + 1:
				flag = True
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	flag = False
	for i in range(1, n + 1):
		if k % i == 0:
			t = k // i
			if t <= n - i + 1:
				print('YES')
				flag = True
				break
	if flag:
		continue
	else:
		print('NO')


t = int(input())
for k in range(0, t):
	(n, w) = map(int, input().split())
	count = 0
	for i in range(1, n + 1):
		if w % i == 0:
			b = w // i
			if b <= n and b <= abs(i - n) + 1:
				count += 1
	if count == 0:
		print('NO')
	else:
		print('YES')


try:
	for _ in range(int(input())):
		(N, W) = map(int, input().split())
		f = 0
		if W <= N:
			print('YES')
			continue
		for i in range(1, N + 1):
			if W % i == 0 and W // i <= N - i + 1:
				print('YES')
				f = 1
				break
		if f == 0:
			print('NO')
except:
	pass


ans = ''
for _ in range(int(input())):
	(n, x) = list(map(int, input().split()))
	poss = False
	for i in range(1, n + 1):
		if x % i == 0 and n - i + 1 >= x // i:
			poss = True
			break
	if poss:
		ans += 'YES\n'
	else:
		ans += 'NO\n'
print(ans)


import collections
from collections import defaultdict
for _ in range(int(input())):
	(n, x) = [int(x) for x in input().split()]
	ans = 'NO'
	for l in range(1, n + 1):
		if x % l == 0:
			m = x // l
			if l <= n - m + 1:
				ans = 'YES'
				break
	print(ans)


import math
t = int(input())
for tc in range(t):
	(n, x) = map(int, input().split())
	y = None
	if n % 2 != 0:
		y = (n // 2 + 1) * (n - n // 2)
	else:
		y = n // 2 * (n - n // 2 + 1)
	if x > y:
		print('NO')
		continue
	ans = False
	for i in range(1, n + 1):
		if x % i == 0:
			z = x // i
			if n >= z + i - 1:
				ans = True
				break
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	flag = False
	if y >= 1 and y <= x:
		flag = True
	for i in range(1, x + 1):
		if y % i == 0 and y // i <= x - i + 1:
			flag = True
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	notFound = True
	if x <= n:
		print('YES')
	else:
		count = 1
		while count < n + 1:
			limit = n - count + 1
			if x % count == 0:
				if x // count <= limit:
					print('YES')
					notFound = False
					break
			count += 1
		if notFound:
			print('NO')


import math
try:
	for _ in range(int(input())):
		(n, x) = list(map(int, input().split()))
		ans = False
		for len in range(1, n + 1):
			ans |= x % len == 0 and x / len <= n - len + 1
			if ans:
				break
		if ans:
			print('YES')
		else:
			print('NO')
except:
	pass


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	pos = False
	for i in range(1, n + 1):
		pos |= x % i == 0 and x // i <= n - i + 1
	if pos:
		print('YES')
	else:
		print('NO')


t = int(input())
for p in range(t):
	(n, x) = map(int, input().split(' '))
	l = []
	for i in range(n):
		l.append(i + 1)
	i = 1
	h = 0
	while i <= n:
		if x % i == 0 and x / i <= n - i + 1:
			print('YES')
			h = 1
			break
		i += 1
	if h == 0:
		print('NO')


def fixweight(test_case):
	(n, x) = map(int, input().split())
	count = 0
	for i in range(1, n + 1):
		if x % i == 0 and x // i <= n - i + 1:
			count += 1
			break
		else:
			continue
	if count == 1:
		print('YES')
	else:
		print('NO')
for i in range(int(input())):
	fixweight(i)


for t in range(int(input())):
	(n, x) = map(int, input().split())
	p = False
	for len in range(1, n + 1):
		p |= x % len == 0 and x / len <= n - len + 1
		if p:
			break
	if p:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(n, x) = map(int, input().split())
	if n >= x:
		print('YES')
	else:
		l = n // 2 + 1
		r = (n - l + 1) * l
		if x > r:
			print('NO')
		else:
			count = 0
			for i in range(1, n + 1):
				if x % i == 0:
					if n - i + 1 >= x / i:
						count += 1
						break
			if count:
				print('YES')
			else:
				print('NO')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	if n >= x:
		print('YES')
	else:
		gg = n // 2 + 1
		xx = (n - gg + 1) * gg
		if x > xx:
			print('NO')
		else:
			flag = False
			for i in range(1, n + 1):
				if x % i == 0:
					if n - i + 1 >= x / i:
						flag = True
						break
			if flag == True:
				print('YES')
			else:
				print('NO')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	if n >= x:
		print('YES')
		continue
	f = 0
	for i in range(n, 0, -1):
		if x % i == 0:
			a = i
			b = x // i
			if b <= n - a + 1:
				f = 1
				break
	if f:
		print('YES')
	else:
		print('NO')


import math

def ans(n, x):
	i = 1
	while i <= n:
		if x % i == 0:
			m = i
			s = x / i
			if n - i + 1 >= x / i:
				print('YES')
				return
		i += 1
	print('NO')
	return
for _ in range(int(input())):
	(n, x) = [int(i) for i in input().split()]
	ans(n, x)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	cnt = 0
	for i in range(1, n + 1):
		if x % i == 0 and x // i <= n - i + 1:
			cnt = 1
			print('YES')
			break
	if cnt == 0:
		print('NO')


for _ in range(int(input())):
	(N, X) = map(int, input().split())
	A = list(range(1, N + 1))
	for i in range(1, N + 1):
		if X % i == 0 and X // i <= N - i + 1:
			print('YES')
			break
	else:
		print('NO')


for _ in range(int(input())):
	(N, X) = [int(i) for i in input().split()]
	flag = 0
	for i in range(1, N + 1):
		if X % i == 0 and X / i <= N - i + 1:
			flag = 1
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	ans = False
	for i in range(1, n + 1):
		if x % i == 0 and x // i <= n - i + 1:
			ans = True
			break
	if ans:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(n, x) = map(int, input().split())
	f = 0
	for i in range(1, n + 1):
		if x % i == 0:
			if x // i <= n - i + 1:
				print('YES')
				f = 1
				break
	if f == 0:
		print('NO')


def fixweight(n, x):
	for i in range(1, n + 1):
		if x % i == 0:
			c = x // i
			if c <= n - i + 1:
				return 'YES'
	return 'NO'
t = int(input())
for i in range(t):
	[n, x] = list(map(int, input().split()))
	print(fixweight(n, x))


tc = int(input())
while tc > 0:
	(n, x) = map(int, input().split())
	arr = []
	flag = 0
	if n == x:
		flag = 1
	for i in range(1, n + 1):
		if x % i == 0 and x / i <= n - i + 1:
			flag = 1
	if flag == 1:
		print('YES')
	else:
		print('NO')
	tc -= 1


for i in range(int(input())):
	(n, x) = map(int, input().split())
	f = True
	for i in range(1, n + 1):
		if x % i == 0 and x // i <= n - i + 1:
			print('YES')
			f = False
			break
	if f:
		print('NO')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	st = False
	for i in range(1, n + 1):
		st = st or (x % i == 0 and x // i <= n - i + 1)
		if st:
			break
	if st:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
num_test_cases = int(input())
for test_case_ittr in range(num_test_cases):
	(length, target) = [int(x) for x in input().split()]
	possible = False
	for candidate_min in range(1, length + 1):
		(subarray_length, mod) = divmod(target, candidate_min)
		if mod == 0 and subarray_length <= length - candidate_min + 1:
			possible = True
			break
	print('YES' if possible else 'NO')


T = int(input())
for i in range(T):
	(n, k) = [int(X) for X in input().split()]
	ans = 'NO'
	for i in range(1, n + 1):
		if k % i == 0 and n - i + 1 >= k // i:
			ans = 'YES'
			break
	print(ans)


def factors(x, n):
	if x <= n:
		return True
	l = set()
	for i in range(1, n + 1):
		if x % i == 0:
			(a, b) = (i, x // i)
			if a + b <= n + 1:
				return True
	return False
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	print('YES' if factors(x, n) else 'NO')


t = int(input())
for _ in range(0, t):
	inputs = [int(num) for num in input().split()]
	n = inputs[0]
	x = inputs[1]
	minN = 1
	if x <= n:
		print('YES')
	else:
		i = 1
		flag = 0
		for i in range(1, n + 1):
			if x % i == 0 and n >= i + x // i - 1:
				flag = 1
				break
		if flag == 1:
			print('YES')
		else:
			print('NO')


t = int(input())
for _ in range(t):
	(n, x) = list(map(int, input().split()))
	flag = 0
	for mn in range(1, n + 1):
		if x % mn == 0 and x // mn <= n - mn + 1:
			print('YES')
			flag = 1
			break
	if flag == 0:
		print('NO')


t = int(input())
for j in range(t):
	(n, x) = map(int, input().split())
	m = n // 2 + 1
	r = (n - m + 1) * m
	if x > r:
		print('NO')
	else:
		flag = False
		for j in range(1, n + 1):
			if x % j == 0:
				if n - j + 1 >= x // j:
					flag = True
					break
		if flag == True:
			print('YES')
		else:
			print('NO')


from bisect import bisect_left
from re import sub
from typing import DefaultDict
import math
from collections import defaultdict
from math import sqrt
import collections
from sys import maxsize
from itertools import combinations_with_replacement
import sys

def sieve_erasthones(n):
	cnt = 0
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p ** 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	for p in range(n + 1):
		if prime[p]:
			cnt += 1
	return cnt

def calculate(p, q):
	mod = 998244353
	expo = 0
	expo = mod - 2
	while expo:
		if expo & 1:
			p = p * q % mod
		q = q * q % mod
		expo >>= 1
	return p

def count_factors(n):
	i = 1
	c = 0
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				c += 1
			else:
				c += 2
		i += 1
	return c

def ncr_modulo(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def isprime(n):
	prime_flag = 0
	if n > 1:
		for i in range(2, int(sqrt(n)) + 1):
			if n % i == 0:
				prime_flag = 1
				break
		if prime_flag == 0:
			return True
		else:
			return False
	else:
		return True

def smallestDivisor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			return i
		i += 2
	return n

def dict_ele_count(l):
	d = DefaultDict(lambda : 0)
	for ele in l:
		d[ele] += 1
	return d

def max_in_dict(d):
	maxi = 0
	for ele in d:
		if d[ele] > maxi:
			maxi = d[ele]
	return maxi

def element_count(s):
	l = []
	k = s[0]
	c = 0
	for ele in s:
		if ele == k:
			c += 1
		else:
			l.append([k, c])
			k = ele
			c = 1
	l.append([k, c])
	return l

def modular_exponentiation(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 != 0:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def number_of_primefactor(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(n)
	return len(set(l))

def twosum(a, n, x):
	rem = []
	for i in range(x):
		rem.append(0)
	for i in range(n):
		if a[i] < x:
			rem[a[i] % x] += 1
	for i in range(1, x // 2):
		if rem[i] > 0 and rem[x - i] > 0:
			return True
	if i >= x // 2:
		if x % 2 == 0:
			if rem[x // 2] > 1:
				return True
			else:
				return False
		elif rem[x // 2] > 0 and rem[x - x // 2] > 0:
			return True
		else:
			return False

def divSum(num):
	result = 0
	i = 2
	while i <= math.sqrt(num):
		if num % i == 0:
			if i == num / i:
				result = result + i
			else:
				result = result + (i + num / i)
		i = i + 1
	return result + 1 + num

def func(a, s):
	a = str(a)
	s = str(s)
	ans = ''
	i = 0
	j = 0
	while i < len(a) and j < len(s):
		if int(s[j]) >= int(a[i]):
			ans += str(int(s[j]) - int(a[i]))
			i += 1
			j += 1
		elif j < len(s) - 1:
			k = int(s[j:j + 2]) - int(a[i])
			if k >= 10:
				return -1
			else:
				ans += str(k)
				i += 1
				j += 2
		else:
			return -1
	return int(ans)

def ans(n, k):
	if n >= k:
		return 'YES'
	for i in range(1, n + 1):
		if k % i == 0:
			if i <= n and k // i <= n - i + 1:
				return 'YES'
	return 'NO'
for _ in range(int(input())):
	bool = True
	(n, k) = map(int, input().split())
	print(ans(n, k))


from math import *
from collections import *
import os
from io import BytesIO, IOBase
import sys
from bisect import *
from heapq import *
MOD = 1000000007

def subinp():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('op1.txt', 'w')

def binpow(a, b, m):
	a %= m
	x = 1
	while b > 0:
		if b & 1:
			x = x * a % m
		a = a * a % m
		b >>= 1
	return x

def binser(arr, l, r, x):
	while l < r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return mid

def lcm(a, b):
	return a * b // gcd(a, b)

def sod(n):
	l = list(str(n))
	s = 0
	for i in l:
		s += int(i)
	return s

def prime_factors(num):
	l = []
	if num % 2:
		l.append(2)
	while num % 2 == 0:
		num = num / 2
	for i in range(3, int(sqrt(num)) + 1, 2):
		if not num % i:
			l.append(i)
		while num % i == 0:
			num = num / i
	if num > 2:
		l.append(num)
	return l

def factmod(n, p):
	f = defaultdict(int)
	f[0] = 1
	for i in range(1, n + 1):
		f[i] = f[i - 1] * i % MOD
	return f

def largestPower(n, p):
	x = 0
	while n:
		n //= p
		x += n
	return x

def modFact(n, p):
	if n >= p:
		return 0
	res = 1
	isPrime = [1] * (n + 1)
	i = 2
	while i * i <= n:
		if isPrime[i]:
			for j in range(2 * i, n, i):
				isPrime[j] = 0
		i += 1
	for i in range(2, n):
		if isPrime[i]:
			k = largestPower(n, i)
			res = res * binpow(i, k, p) % p
	return res

def drec(x, y):
	if y == x + 1:
		return 'R'
	if y == x - 1:
		return 'L'
	if x < y:
		return 'D'
	return 'U'

def cellhash(x, y):
	return (x - 1) * m + y

def bins(l, x, n):
	i = bisect_left(l, x)
	if i < n:
		return i
	if i:
		return i - 1
	else:
		return n

def cond(l):
	for i in range(len(l) - 1):
		if l[i] == str(int(l[i + 1]) - 1):
			return False
	return True

def isvowel(s):
	if s in list('aeiou'):
		return 1
	return 0

def countOdd(L, R):
	N = (R - L) // 2
	if R % 2 != 0 or L % 2 != 0:
		N += 1
	return N

def tst(A, B, C):
	return (A | B) & (B | C) & (C | A)

def palcheck(n, s):
	(i, j) = (0, n - 1)
	while i <= j:
		if s[i] == s[j]:
			return False
		i += 1
		j -= 1
	return True

def sakurajima(n):
	if n < 9:
		n = 10
	l = [0]
	for i in range(1, n + 1):
		if i % 2:
			l.append(i)
		else:
			l.append(2)
	for i in range(3, int(n ** 0.5) + 1, 2):
		if l[i] == i:
			for j in range(i * i, n + 1, i):
				if l[j] == j:
					l[j] = i
	return l

def getfact(x):
	ret = []
	d = defaultdict(int)
	while x != 1:
		ret.append(spf[x] ** (d[spf[x]] + 1))
		d[spf[x]] += 1
		x = x // spf[x]
	return ret

def prchck(n):
	l = [1] * (n + 1)
	l[1] = 0
	for i in range(2, n + 1):
		for j in range(2, int(sqrt(n)) + 1):
			if j % i == 0:
				l[j] = 1
	return l

def ispal(s, n):
	for i in range(n // 2):
		if s[i] != s[n - i - 1]:
			return False
	return True

def bfs(src, dest, ajl, vis):
	q = deque([src])
	vis[src] = True
	while q:
		i = q.popleft()
		if i == dest:
			return True
		for j in ajl[i]:
			if not vis[j]:
				vis[j] = True
				q.append(j)
	return False

class DisjSet:

	def __init__(self, n):
		self.size = [1] * n
		self.parent = [i for i in range(n)]

	def find(self, x):
		if self.parent[x] != x:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, x, y):
		xset = self.find(x)
		yset = self.find(y)
		if xset == yset:
			return
		if self.size[xset] < self.size[yset]:
			self.parent[xset] = yset
			self.size[yset] += self.size[xset]
		else:
			self.parent[yset] = xset
			self.size[xset] += self.size[yset]

def dfs(i, ajl, vis, l, x):
	vis[i] = True
	l[i] = x
	for j in ajl[i]:
		if not vis[j]:
			dfs(j, ajl, vis, l, x)

def func1(arr, n, v, Sum):
	if Sum == 0:
		return len(v)
	if Sum < 0:
		return sys.maxsize
	if n == 0:
		return sys.maxsize
	x = func1(arr, n - 1, v, Sum)
	v.append(arr[n - 1])
	y = func1(arr, n, v, Sum - arr[n - 1])
	v.pop(len(v) - 1)
	return min(x, y)

def panda(n, x):
	if x <= n:
		return 'YES'
	for i in range(1, n + 1):
		if not x % i:
			y = x // i
			if y <= n - i + 1:
				return 'YES'
	return 'NO'
t = 1
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	print(panda(n, x))


t = int(input())
for i in range(t):
	(n, x) = input().split()
	n = int(n)
	x = int(x)
	count = 0
	for len in range(1, n + 1):
		if x % len == 0 and x / len <= n - len + 1:
			print('YES')
			count = count + 1
			break
		else:
			continue
	if count == 0:
		print('NO')


def func(n, x):
	for i in range(1, n + 1):
		if x % i == 0 and n - i + 1 >= x // i:
			return 'YES'
	return 'NO'
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	print(func(n, x))


try:
	for _ in range(int(input())):
		(n, x) = map(int, input().split())
		if x <= n:
			print('YES')
		else:
			k = 0
			for i in range(1, n + 1):
				if x % i == 0 and x // i <= n - i + 1:
					k = 1
					break
			if k == 1:
				print('YES')
			else:
				print('NO')
except:
	pass


for _ in range(int(input())):
	(n, x) = map(int, input().split(' '))
	test = 0
	for i in range(1, n + 1):
		if x % i == 0 and x // i <= n - i + 1:
			print('YES')
			test = 1
			break
		else:
			continue
	if test == 0:
		print('NO')