runtime error in fibonnaci numebr

i am trying to find a fibonnaci number by dp but my code giving runtime error many times.
what may be the problem?

#include <iostream>
#include <cstdio>
using namespace std;


long long int fib(long long int n,long long int *arry){
if (arry[n]!=0)return arry[n];
else if(n==0)return 1;
else
    arry[n]=(fib((n-1),arry)+fib((n-2),arry));
    return arry[n];
}

int main()
{
    long long int *meomarray;
    long long int n,t,temp,i;
    cin>>t;
    while(t--){
        cin>>n;
        meomarray = new long long int[n+1];
        for(i=0;i<=n;i++)meomarray[i]=0;
        meomarray[0]=1;
        meomarray[1]=1;
        temp=fib(n,meomarray);
        cout<<temp<<endl;
    }

    return 0;
}

I think this question is related to an ongoing contest question. Only thing i will say is you cannot allocate that much memory since n is 10^9.

but now i have seen other users answers they are also allocating that much memory but getting AC and the max size is 10^6 not 10^9
other user solution you can find here http://www.codechef.com/viewsolution/3455890
my solution
http://www.codechef.com/viewsolution/3458198

The memory allocated by him is around 10^7 if you look at his array declaration carefully while yours might go upto 10^9


hey! given Constraints are
1 <= T <= 10000 1 <= N <= 10^6
so my max array size is 10^6 ?
please clarify why i am getting run time error?

Make the meomarray[] global. you don’t need to pass the array. It will save your time as well.

Make the meomarray[] global. you don’t need to pass the array. It will save your time as well.

//