MaxSubProduction version I
buggy solution for maxsubproduction