Maximum circular sum

can i know what’s wrong with my code?

#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
ll t;cin>>t;
while(t–)
{
ll n;cin>>n;
vector a(n);
for(ll i=0;i<n;i++)
{
cin>>a[i];
}
ll csum=0,maxsum=0;
for(ll i=0;i<2*n-1;i++)
{
if(i<n)
{csum+=a[i];
if(csum<0)
{
csum=0;
}
else if(csum>maxsum)
{
maxsum=csum;
}}
else if(i>=n)
{
csum+=a[i-n];
if(csum<0)
{
csum=0;
}
else if(csum>maxsum)
{
maxsum=csum;
}
}

    }
   cout<<maxsum<<endl;
}
return 0;

}

Refer the approach from here Maximum circular subarray sum
https://www.geeksforgeeks.org/maximum-contiguous-circular-sum/

Also do not share the code directly. Save your code on ide.codingblocks.com and then share its link.It is easy for us to debug then.

@bommareddyjyothiswaroopreddy Please mark your doubt as resolved if it is so.

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.