How do add values in a vector using a sliding window?

Greetings.

I have a vector of numbers such as the following:

1
75
79
90
91
92
109
120
167
198
203
204
206
224
230
236
240
245
263
344
427
451
461
476
528
619
627
649
681
701
824
852
911
924
965
978
986

And I would like to know the number of values that fall within a certain sliding window, say 50. The result for the vector above, for a window-size of 50 is:

50	1
100	5
150	2
200	2
250	8
300	1
350	1
400	0
450	1
500	2
550	1
600	0
650	3
700	1
750	1
800	0
850	1
900	1
950	2
1000	3

Showing that there is 1 entry falling in the range 1-50, 5 entries in 51-100, 2 entries for 101-150, etc.

Whereas, for a window-size of 250 the results should look like:

250	18
500	6
750	6
100	7

I feel like there must be an easy one-liner for this, but I haven't been able to figure it out.

Thanks!

awk -f twink.awk myFile
awk -v w=250 -f twink.awk myFile

twink.awk:

BEGIN {
  if (!w) w=50
}
{ a[int($0/w)]++ }
END {
  for (i in a)
    print (i*w)+w, a
}

Do you require a zero count when the range is empty?

@Chubler_XL Yes, please.

Try this slight change to vgersh99's post:

awk -v w=250 '
!w{w=50}
{
 v=int($0/w)
 a[v]++
 m=(m>v)?m:v
}
END{for(i=0;i<=m;i++) print w+i*w, 0+a}' infile