The other answers showed that the energy of the final system is greater than the energy of the initial system, because you are heating the gas. Here's another way to see this:
In the first step, you remove the weight at height $h_1$. In the second step you replace it at a higher height, $h_2$. In between these steps you need to bring the weight up from $h_1$ to $h_2$, which takes work. The environment will lose energy in performing this work, so the system must gain energy to compensate. Thus, One might object that you could just even things out in the end by transferring energy is transferredback from the environmentsystem to the systemenvironment. You are not back where you started at However, the endenvironment lost energy in the form of work, and the system gained energy in the form of heat, so the net energy transfer is irreversible.