This is my submission for the Insight data challenge. I have used Python 2.7 for this challenge. I created an object which stores the necessary information to be written in the output file. I used Min Heap and Max Heap to get the running median for the first part. I have used the heapq library for this purpose. In the second part, I maintained an array which I sort and take the middle element to find the median at the end.