in reply to subtracting two lines in file

Is the 4 in your desired output a typo? Or is there another rule you're only going to tell us after getting answers? Anyway, a one-liner, assuming your numbers are space separated:
perl -anE '($s,$F[1])=($F[1],$F[1]-$s);say "@F"' <your-file>