Accumulate the sum of a list of numbers using only ram-fetch and ram-store mimicking how RAM works in real life. With respective run-time of O(n^2), O(n+m) and O(nlogm), where n is the number of elements in the list, and m is the maximum element in the list.