Please tell me why there is a segmentation fault error in my code.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
vector<vector> multiply(vector<vector> A,vector<vector> B)
{
vector<vector> C(2,vector(2));
for(int i=0;i<2;i++)
{
for(int j=0;j<2;j++)
{
for(int x=0;x<2;x++)
{
C[i][j] = (C[i][j] + (A[i][x]*B[x][j])%mod)%mod;
}
}
}
return C;
}
vector<vector> pow(vector<vector> A,ll p)
{
if(p==1)
{
return A;
}
if(p&1)
{
return multiply(A,pow(A,p-1));
}
vector<vector> x = pow(A,p/2);
return multiply(x,x);
}
ll compute(ll n)
{
vector<vector<ll>> T = {{1,1},{1,0}};
T = pow(T,n-1);
ll res=0;
res = (T[0][0])%mod;
return res;
}
int main()
{
ll t;
cin>>t;
while(t--)
{
ll n,m;
cin>>n>>m;
ll fm = compute(m+2);
ll fn = compute(n+1);
cout<< ( ( fm - fn ) + mod ) % mod <<endl;
}
return 0 ;
}