In this HackerEarth Furniture Transportation problem solution, The warehouse of the Urban ladder in Bangalore has n packages containing furniture. As the warehouse cannot accommodate all of them, the warehouse manager has decided to transfer m of the packages to a warehouse located in Chennai.

For this reason, all the packages are kept in a line and a number(which determines its value) is written on them. The number is calculated based on the price of the furniture in the package. The greater the number, the more valuable the package is.

Then, the warehouse manager asks you to choose the m packages, which will be transferred to the other warehouse. He also imposed two conditions. They are,
  1. The chosen m packages have to form a contiguous segment of packages.
  2. Any of the chosen package's value should not be greater than a number l as the manager doesn't want to take the risk of damage to the furniture.
Find the number of ways you can choose the m packages.


HackerEarth Furniture Transportation problem solution


HackerEarth Furniture Transportation problem solution.

n,l,m = map(int,input().split())
A = [int(x) for x in input().split()]
count2 = 0
for i in range(n-m+1):
    B = A[i:i+m]
    count = 0
    for j in B:
        if j<=l:
            count+=1
            if count == len(B):
                count2+=1
print(count2)