They dropped two nuclear bombs on Japan to make the Soviet Union's invasion of Hokkaido unnecessary and as a performative act to horrify the world in to subjugation.
The whole 'saved more lives than it cost' is a bad argument unless the plan was to slaughter a hundred thousand civilians on landing. Note the Nazi invasion of France cost 60,000 lives in civilian resistance...this was at the beginning of the war.
Japan would have surrendered on the first day of invasion.
What about Japan's repeated offers to surrender as long as they could keep their emperor?
It wasn't just about keeping the Emperor, Japan wanted to maintain Imperial Sovereignty, that is the right of the Emperor to not only be kept from removal or persecution but to stay in power as the sovereign ruler of Japan, and that included at many points during negotiation no military occupation by Allied forces, and even keeping their conquests in China. Of course the Allies wouldn't agree to these sort of terms, it's wasn't so cut-and-dry as "let us keep the Emperor as a figurehead and we will surrender".
Also, from Truman's point of view, preserving American lives was important as I pointed out, but on the other hand, the image to the public of allowing Japan to do a "soft" surrender after spending tens of thousands of troop lives would be pretty bad for his popularity too. The guy was an American president after all :amerikkka:
It's hard to know what exactly could have been agreed on as a peace deal. The Japanese starting point was keeping everything they still had but they seemed willing to negotiate that away. You're right that "keeping the emperor" meant for Japan was keeping him as the "Sovereign Ruler" and exempt from prosecution. That being said, he was already a figurehead before the US came in and he wasn't prosecuted anyway. These could have been soft diplomatic understandings rather than something written down in the actual treaty. The US was willing to do that for the Nazis, making assurances about who would and would not be prosecuted.
Yeah and that's all correct, I'm just arguing that the reason for the bombs was not a proto-cold war move against the Soviet Union. I don't think the bombs or any targeting of civilians were justified at all, but arguing the proto-cold war reasoning is something leftists tend to zoom in on too quickly without researching, it is ahistorical and adds a layer of hindsight bias coloured by our own leftist bias that simply isn't necessary in order to to condemn the bombings.