Push the element to container and hash the L and R
for ( int i = 0 ; i < n ; i ++ ) { v . Add ( a [ i , 0 ] ) ; if ( ! mpp . ContainsKey ( a [ i , 0 ] ) ) mpp . Add ( a [ i , 0 ] , 1 ) ; v . Add ( a [ i , 1 ] ) ; if ( ! mpp . ContainsKey ( a [ i , 1 ] ) ) mpp . Add ( a [ i , 1 ] , 2 ) ; }