Time limit exceeded in Heap
Some generic comments about your code, not related to your problem.



using namespace std;


There are some developers which consider importing a whole namespace (overwriting some standard functions with imported ones) as very bad practice. I'm not qualified enough to make comments on that, but it's something you should keep in mind.



You're inconsistent about your usage of letter casing.

int sift_down( ...
void Extract_Max( ...


That's one of the things you should fix first, there is no standard for C/C++ when it comes to casing, but at least be consistent within your source code. And even better, have a look at what everyone else in your environment does and copy that.



int sift_down(long long int *a, int i, int n){
    int l = 2 * i;
    int r = 2 * i + 1;


To abuse a very popular movie quote:


  I find your lack of properly named variables disturbing.


There is absolutely no valid reason to use single letter variable names in production code, with the only exception of dimensions (x, y, z) and loop variables (i, j, k).

You might also notice that, normally, an integer with the name i is only used inside loops. Seeing it as a parameter to a function is...disturbing.



The lack of comments is also problematic, especially when it comes to rather complex implementations.