#include

#include<string.h>

using namespace std;

```
int sol[5000][10];
char lex[5000],lext[5000];
int n[5],cases;
void inputd()
{
cin>> cases ;
if(cases<6)
for(int t=0;t<cases;t++)
{
cin >> n[t];
if(n[t]<5001)
for(int i=0;i<n[t];i++)
{
cin >> sol[i][t*2] >> sol[i][t*2+1];
}
}
}
int isI(int i,int t)
{
int l=sol[0][0];
int j=0;
int k=i;
if(i)
{
for(;j<n[t]&&k>-1;j++)
{
if(sol[j][t*2]<=i&&sol[j][t*2+1]>=i)
{
k--;
lext[j]='1';
}
else
lext[j]='0';
}
if(k==0)
{
if(strcmp(lex,lext)>0)
for(j=0;j<n[t];j++)
lex[j]=lext[j];
return true;
}
return false;
}
else
{
for(j=0;j<n[t];j++)
{
if(sol[j][t*2]==0)
{
return 0;//0 not possible
}
}
for(j=0;j<n[t];j++)
{
lex[j]='0';
}
return 1;
}
// return true;
}
void clearlex(int t)
{
int i=0;
for(;i<t;i++)
{
lex[i]=lext[i]='1';
}
lex[i]=lext[i]='\0';
}
int main ()
{
int a,c=0,t=0;
inputd();
// sol={1,4,2,,4,3,4,4,4}};
for(;t<cases;t++)
{
clearlex(n[t]);
c=0;
for(int i=0;i<=n[t];i++)
{
if(isI(i,t))
c=(c+1)%1000000007;
}
cout <<endl << lex << endl << c << endl;
}
cin >> a;
return 0;
}
```

This is my code and i am getting a runtime error SIGSEGV. I understand that this is error occcurs due memory segmentation faults. But, i don’t unerstand what to change in my code to avoid that.

Thanks in advance