cppreference.com > C++ Algorithms > partial_sum partial_sum Syntax:
      #include <algorithm>
      iterator partial_sum( iterator start, iterator end, iterator result );
      iterator partial_sum( iterator start, iterator end, iterator result, BinOp p );
The partial_sum() function calculates the partial sum of a range defined by [start,end), storing the output at result. start is assigned to *result, the sum of *start and *(start + 1) is assigned to *(result + 1), etc. partial_sum() runs in linear time. Related topics: accumulate adjacent_difference count inner_product iota