Maximum circular sum , issue

What’s wrong with my code? It’s generating the correct answer, yet on submitting the code it shows the wrong answer in the test case section.
1
7
8 -8 9 -9 10 -11 12

my answer is 22.

#include
using namespace std;
int kadane_algo(int arr[],int test)
{
int ms=0,cs=0;
for(int j=0;j<test;j++)
{
cin>>arr[j];
}
for(int j=0;j<test;j++)
{
cs=cs+arr[j];
if(cs<0){
cs=0;
}
ms=max(cs,ms);
}
return ms;
}
int maxCircularSum(int a[], int n)
{

int max_kadane = kadane_algo(a, n);
int max_wrap = 0, i;
for (i=0; i<n; i++)
{
max_wrap += a[i];
a[i] = -a[i];
}
max_wrap = max_wrap + kadane_algo(a, n);
int y = (max_wrap > max_kadane)? max_wrap: max_kadane;
cout<<y;
}
int main()
{
int n;
cin>>n;
int test[n];
for(int i=0;i<n;i++)
{
cin>>test[i];
int arr[test[i]];
int x = maxCircularSum(arr,test[i]);
//cout<<x;
}
return 0;
}

@25ajeet hey ajeet please save your code on ide so that i can help you asap

there?
waith i am sharing the link.

https://ide.codingblocks.com/s/69246

@25ajeet hey ajeet I made some modification you can refer this.

what are some changes

TESTCASE # 1 : wrong-answer (Time: 0 s)

this is what i am dealing with

correct output is coming yet the output is "TESTCASE # 1 : wrong-answer (Time: 0 s) "

@25ajeet hey try with check your running your program for t no test cases so you should use endl but i checked your code is giving wrong ans after putting endl you can check it by your self
run your code after putting endl and you will identify what happen with your program

see as my logic is correct , please help me out to get this right.

@25ajeet this is the code now check with the previous one you will able to find out the changes
this. now please apply test case t

@25ajeet hey ajeet if any queries comes feel free to ask.I am so glad to solve your doubt