Just to understand how can it works, imagine to subtract 100 to the number in the first column when the other one in the second column changes by one. For example >> if changes from 20 to 21 then add 100 to 80381, if it changes from 20 to 19 subtract 100 to 80381..that's it.
Any idea it can be done with a shell script while reading a whole file?
A few things to note here:-
As you are using 'bash' your data shows us pseudo-floating point arithmetic.
Are we to assume that anything beyond the floating point can be ignored?
If it can't be ignored do we round up or down, or both depending on the floating point value?
Why are there commas, (field separators?), on the last two lines?