Input: arr[] = {2, 0, 4, 6, 2}, x = 2
Output: 2 0 0 1 2
For x = 2, the average values for 2, 0, 4, 6, 2 would be 2, 1, 3, 4, 2 respectively. So, the count array would result in 2, 0, 0, 1, 2.
Input: arr[] = {9, 5, 2, 4, 0, 3}, x = 3
Output: 0 1 1 1 0 1
For x = 3, the average values for 9, 5, 2, 4, 0, 3 would be 6, 4, 2, 3, 1, 2 respectively. So, the count array would result in 0, 1, 1, 1, 0, 1.