CAN I GET SOLUTIONS

You have �N balls and �K boxes. You want to divide the �N balls into �K boxes such that:

  • Each box contains ≥1≥1 balls.
  • No two boxes contain the same number of balls.

Determine if it is possible to do so.

Input Format

  • The first line contains a single integer �T — the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains two space-separated integers �N and �K — the number of balls and the number of boxes respectively.

Output Format

For each test case, output YES if it is possible to divide the �N balls into �K boxes such that the conditions are satisfied. Otherwise, output NO.

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

Sample 1:

Input

Output

4 3 4 30 3 2 2 1 1

NO YES NO YES

Explanation:

Test Case 1: It is not possible to divide the 33 balls into 44 boxes such that each box contains ≥1≥1 balls.

Test Case 2: One way to divide the 3030 balls into 33 boxes is the following: [5,9,16][5,9,16].

Test Case 3: It is not possible to divide the 22 balls into 22 boxes such that no two boxes contain the same number of balls.

Test Case 4: We can divide 11 ball into 11 box.

This is the code i think it helps you

include <stdio.h>

int main() {
int T;
scanf(“%d”, &T);
for (int i = 0; i < T; i++) {
int N, K;
scanf(“%d %d”, &N, &K);
if (N >= K*(K+1)/2) {
printf(“YES\n”);
} else {
printf(“NO\n”);
}
}
return 0;
}