Answer:
For this particular problem, it is possible that all the thermal energy absorbed by the gas becomes work done by the piston.
Explanation:
It is important to note that the Kelvin-Planck statement refers to cyclic processes, which leave the system in a final state equal to the initial one. It is possible to transform calories at work if the final state is different from the initial state. An example of this is in an isothermal expansion of a gas, all the heat that enters is transformed entirely in the work, but in the end the volume of the gas is different from the initial one.