title: Sum lines below each line in a file linux
body: <p>I have input like this</p>
  
  <pre><code>A  100
  B  150
  C  200
  D  250
  E  300
  </code></pre>
  
  <p>THe output i want is the sum of of all the elements above that: Something like this</p>
  
  <pre><code>   A to A - 100
     A to B - 250
     A to C - 450
     A to D - 700
     A to E - 1000
     B to B - 150
     B to C - 350
     B to D - 600
     B to E - 900
     C to C - 200
     C to D - 450
     C to E - 650
     D to D - 250
     D to E - 550
     E to E - 300
  </code></pre>
  
  <p>The file size is around 250 MB. I wrote a python program which stores everyline in a dictionary first. But i think it is not feasible for large inputs. I am a beginner using linux.</p>