# Code not working on codechef but runs on codeblocks, help!

Problem Link : https://www.codechef.com/SEPT20B/problems/COVID19B

Code giving SIGTSTP error while compiling and WA after submit on CodeChef
But it gets compiled without error and gives correct answers for all cases on CodeBlocks.
Can anyone please help ??

``````#include<iostream>
#include<vector>
using namespace std;

void fun(int i,double time,int &sum, vector<vector<vector<double>>> &TimeMap)
{
for(int j = 0;j<TimeMap[i].size();j++)
for(int k=1;k<TimeMap[i][j].size();k++)
if(TimeMap[i][j][0] > time)
fun(TimeMap[i][j][k],TimeMap[i][j][0], ++sum, TimeMap);
}

int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
cin>>arr[i];
vector<vector<vector<double>>> TimeMap;
for(int i = 0;i<n;i++)
{
vector<vector<double>> t1;
for(int j = 0;j<n;j++)
{
vector<double> t2;
if(arr[j]==arr[i] || i==j)
continue;
double tim = double(i-j)/double(arr[j] - arr[i]);
if(tim>0)
{
bool flag = 1;
for(int k=0;k<t1.size();k++)
if(t1[k][0]==tim)
{
t1[k].push_back(j);
flag = 0;
break;
}
if(!flag)
break;
t2.push_back(tim);
t2.push_back(j);
t1.push_back(t2);
}
}
TimeMap.push_back(t1);
}
int sum, minn=10, maxx=0;
for(int infected = 0;infected<n;infected++)
{
sum = 0;
fun(infected,0,sum, TimeMap);
if(sum > maxx)
maxx = sum;
if(sum < minn)
minn = sum;
}
cout<<(minn+1)<<" "<<(maxx+1)<<endl;
}
return 0;
}``````

check for array bounds and stuff like that, you are trying to access some prohibited memory location somewhere