Incorrect output

Hi, I fail to understand the problem with this code. Problem code is COPS. Any explanation will be highly appreciated.

m, x, y = map(int, input().split())
c = list(map(int, input().split()))
ans = 0
dist = x*y
house = list(map(int, range(1,101)))
for i in range(m):
left_range = max(1,c[i]-dist)
right_range = min(100,c[i]+dist)
for j in range(len(house)):
if house[j] >= left_range and house[j] <= right_range:
ans = ans+1