#K69377. Candy Distribution Problem
Candy Distribution Problem
Candy Distribution Problem
You are given two integers n and m. Your task is to determine whether it is possible to distribute m candies into n bags such that each bag contains a unique number of candies. In mathematical terms, you need to check if m is at least \(\frac{n(n+1)}{2}\), which is the sum of the first n positive integers.
If \(m \geq \frac{n(n+1)}{2}\), then output YES
; otherwise, output NO
.
inputFormat
A single line containing two space-separated integers: n and m ((1 \leq n, m \leq 10^9)).
outputFormat
A single line: YES
if it is possible to distribute the candies according to the condition, otherwise NO
.## sample
3 6
YES