Seeking help!!

Hi!!
I have tried to solve this problem from practice section more than 20+ times, but still I am getting wrong answer; I am not able to understand where is my solution approach failing. It will be highly appreciated if anybody can help with the same, as of which where are my test cases failing.
Below is the submission link for the same::
Solution: 55343203 | CodeChef[Submission Link]

Below is my code for this MSUM problem:::

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

int getGCD(vectorv){
if(v.size()==0) return 0LL;
if(v.size()==1) return v[0];
ll gcd=v[0];
for(int i=1; i<v.size();i++) gcd=__gcd(v[i],v[i-1]);
return gcd;
}

void solve(){
int n;
cin>>n;
vectorarr(n),pos,neg;
for(int i=0; i<n;i++) cin>>arr[i];
for(int i=0; i<n;i++){
if(arr[i]>0)(pos.pb(arr[i]));
if(arr[i]<0)(neg.pb(-arr[i]));
}
int gcdpos=getGCD(pos);
int gcdneg=getGCD(neg);

if(n==2 && pos.size()==1 && neg.size()==1){
cout<<pos[0]+neg[0]<<endl;
return;
}
else if(pos.size()==0 || neg.size()==0){
cout<<(gcdpos+gcdneg)<<endl;
return;
}
else{
cout<<2*(__gcd(gcdpos,gcdneg))<<endl;
return;
}}

int main(){
#ifndef ONLINE_JUDGE
freopen(“inputx.txt”,“r”,stdin);
freopen(“outputx.txt”,“w”,stdout);
#endif
int t;
cin>>t;
while(t–){
solve();
}}