Continuing the discussion from CHVSDO - Where is my solution getting WA:

@light301 Your code was absolutely right but missed one corner case. Think what would be your answer when L=1. Since 1 is not a prime number so , number of prime factors of 1 is “0”.

So the total number of subsets having sum S would be doubled , because for every subset we can get a new subset by including “0” to that set.

eg - 1 6 2

Your output : 7

Correct output : 14 ( forming a new subset of every subset by including 0 )