Code is not working but work in sublime

#include
using namespace std;

// Function to find contiguous sub-array with the largest sum
// in given set of integers
int kadane(int arr[], int n)
{
// stores maximum sum sub-array found so far
int max_so_far = 0;

// stores maximum sum of sub-array ending at current position
int max_ending_here = 0;

// traverse the given array
for (int i = 0; i < n; i++)
{
	// update maximum sum of sub-array "ending" at index i (by adding
	// current element to maximum sum ending at previous index i-1)
	max_ending_here = max_ending_here + arr[i];

	// if maximum sum is negative, set it to 0 (which represents
	// an empty sub-array)
	max_ending_here = max(max_ending_here, 0);

	// update result if current sub-array sum is found to be greater
	max_so_far = max(max_so_far, max_ending_here);
}

return max_so_far;

}

int main()
{
int ans[1000];
int t,c;
cin>>t;
for(c=0;c<t;c++)
{

int arr[1000];
int n;
cin>>n;
int z;
for(z=0;z<n;z++)

{
cin>>arr[z];
}

//int n = sizeof(arr)/sizeof(arr[0]);

ans[c]=kadane(arr,n);
//cout<<kadane(arr, n);
}

for(int u=0;u<t;u++)
{
cout<<ans[u]<<endl;
}

return 0;

}

@chandeep correct the array size as 1 <= N <= 100000
also take type as long long to avoid overflow.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.