Thermodynamic cycles 
Consider a system that takes excess air (assume it to be an ideal gas, $Cp = \frac{7}{2} R$) from a power plant stack at $370 \rm K$ (typo in figure) and $2$ bar and compresses it to 20 bar adiabatically and reversibly. Since the air will heat as it compresses, we can send the outlet to a Carnot engine, and produce enough work to power the compressor by rejecting the heat to the water below a frozen at $273 \rm K$. The temperature of the expelled air is $275 \rm K$ We still have compressed air at $20$ bar coming out of the Carnot engine to use elsewhere! Free energy. 
This cannot be possible. So, which law is being violated in this system? 


*

*Since the compressor is adiabatic and reversible, we know that $Q = 0 \implies \Delta S= 0$. From the adiabatic relations, we know that the temperature in the outlet of the compressor is $714.36 \rm K$. The work done by the compressor is a flow work given by $$\int V \rm d P = \frac{\gamma}{\gamma - 1} RT_1 \Bigg(\Big(\frac{P_2}{P_1} ^{\frac{\gamma -1}{\gamma}} -1\Big)\Bigg) = 4097.89 J$$

*Onto the Carnot engine. We know that $T_{hot} = 614.36 \rm K$ and $T_{cold} = 275 \rm K$.
Using the theorem of Clausius for a Carnot engine, $\frac{Q_{hot}}{T_{hot}} + \frac{Q_{cold}}{T_{cold}} = 0$. 
We know that $Q_{cold} = C_p\Delta T = 12784.9 J$.
Plugging this value into the theorem of Clausius, $Q_{hot} = 33451.9 J$. 
Using $Q_{hot} = Q_{cold} + W_{C}$, we get the work done by the system is $20667.9J$. 
Hence, the reversible adiabatic compressor is getting more work done on it and it is doing less work than it is getting. So this violates the first law, right? 
Does it also violate the second law? 
Any advice would be appreciated.
 A: What you are proposing is referred to generically as a "topping cycle" and is in common use around the world to extract a little useful work out of the exhaust streams of factory furnaces and power plant stacks, etc. 
In fact there are firms that design, construct, and install topping cycle systems that run on a variety of different thermodynamic cycles.
Much has been written about the economics of topping cycle installations (try a google search), but the one thing they all share is the need to operate on the basis of a large mass flow combined with a small temperature difference. This means the machinery has to be sizeable, and the cycle efficiencies will be carnot-limited to very low figures.   
A: Your calculation is really messed up.  You are saying that $Q_{cold}$ is the heat transferred from the compressed air to the ice, but this is supposed to be the heat transferred from the Carnot cycle working fluid to the ice.  The compressed air is not the Carnot cycle working fluid.  At best, you can use the compressed air to heat the Carnot cycle working fluid during the heating phase of the Carnot cycle, but, in that case, the compressed air could not give up enough heat for its temperature to cool to 275 K, because then it would come out cooler than the high temperature part of the Carnot cycle, and you would be transferring heat from cold to hot.
