The well-known Hardy--Ramanujan inequality states that if I¨(n) denotes the number of distinct prime factors of a positive integer n, then there is an absolute constant C>0 such that uniformly for x≥2 and k∈N, \[\#\{n\le x\colonÏ(n)=k\}\ll\frac{x(\log\log x+C)^{k-1}}{(k-1)!\log x}.\] A myriad of generalizations and variations of this inequality have been discovered. In this paper, we establish a weighted version of this inequality for sifted sets, which generalizes an earlier result of Halász and implies Timofeev's theorems on shifted primes. We then explore its applications to a variety of intriguing problems, such as large deviations of I¨ on subsets of integers, the ErdÅs multiplication table problem, divisors of shifted primes, and the image of the Carmichael I^»-function. Building on the same circle of ideas, we also generalize Troupe's result on the normal order of I¨(s(n)) for the sum-of-proper-divisors function s(n), confirming for the first time the weighted version of a special case of a 1992 conjecture by ErdÅs, Granville, Pomerance, and Spiro.