Polished 2sum alg, set up median maintenance alg