I’m using the same Hugo version and I couldn’t reproduce the behaviour you described above. There’s a very good chance that the issue you’re highlighting is a styling quirk
My original problem is on Windows/Linux mix: I ran hugo server from WSL Ubuntu and viewed the website on the host Windows in Firefox (and Edge).
But now I have now tested it on Mac OS (same version of Hugo), ran hugo server from Mac OS terminal and viewed website also on Mac OS in Firefox (and Safari) - the problem isn’t there, I get the same result as on your screenshot.
Definitely looks like it, although it is still weird why the same lines with the same endings get rendered differently with just a different syntax highlighting language (csharp instead of cpp, for example).