func_code_string: #include <bits/stdc++.h>   #include <iostream>   #define ll long long   using namespace std;      const long long mod=998244353;   const long long mod2=1ll<<32;   const double pi = 2 * acos(0.0);      const ll N=200001;         bool compare(pair<int,int> quan1,pair<int,int> quan2)   {       return quan1.second <quan2.second ;   }   ll power(ll base,ll expo)   {       ll ans=1;       while(expo>0)       {           if(expo%2==1)           {               ans*=base;               ans=(ans)%mod;               expo--;           }           else           {               base*=base;               base=(base)%mod;               expo/=2;           }       }       return ans;   }      ll minimax(ll t, bool isMax,ll score,ll h,ll scores[])   {       if (t+1 == h)     return score;       if (isMax&&scores[t]!=1)       {         if(scores[t]%2==0)         {           return max(minimax(t+1, false, score+scores[t]-1, h,scores),      minimax(t+1,true, score+scores[t], h,scores));         }         else         {          return max(minimax(t+1, true, score+scores[t]-1, h,scores),      minimax(t+1, false, score+scores[t], h,scores));         }       }    else if (isMax&&scores[t]==1)       {         return minimax(t+1, false, score+1, h,scores);       }       else if (!isMax&&scores[t]!=1)       {         if(scores[t]%2==0)         {           return max(minimax(t+1, true, score, h,scores),      minimax(t+1,false, score, h,scores));         }         else         {          return max(minimax(t+1, false, score, h,scores),      minimax(t+1, true, score, h,scores));         }       }      else if (!isMax&&scores[t]==1)       {        return minimax(t+1, true, score, h,scores);       }   }      long long exponentiation(long long num_one,long long num_two,long long Mod)   {       long long answer= 1;       num_one = ((num_one)+Mod) % Mod;       while (num_two > 0)       {           if (num_two & 1)           {               answer =(((answer*num_one))+Mod) % Mod;           }           num_two = num_two>>1;           num_one = (((num_one*num_one))+Mod) % Mod;       }       return ((answer%Mod))%Mod;   }      ll combi(ll n,ll r,ll mod)   {    if(r==0)       {           return 1;       }       if(r>n)       {           return 0;       }       ll factorial[N+1];       ll inverse_fac[N+1];       factorial[0]=1;       inverse_fac[0]=1;       for(ll i=1;i<=n;i++)       {           factorial[i]=(factorial[i-1]*i)%mod;           inverse_fac[i]=power(factorial[i],mod-2);       }    return factorial[n]* inverse_fac[r]%mod* inverse_fac[n-r]%mod;   }      long long gcd(long long a,long long b)   {       if(b==0)       {           return a;       }       else       {           return gcd(b,a%b);       }   }   ll LCM(ll aa[],ll n,ll Mod)   {       ll lcm = aa[0];          for (ll i=1;i<n;i++)       {           lcm = ((((aa[i]*lcm)%Mod)+Mod)%Mod)/(gcd(aa[i],lcm));       }       return lcm;   }   vector<ll> finding_all_prime_factors(ll n)   {    vector<ll> v;    while(n%2==0)    {     v.push_back(2);     n = n/2;    }    for (ll y=3;y*y<=(n);y+=2)    {     while (n%y==0)     {      v.push_back(y);      n = n/y;     }    }    if(n>2)       {           v.push_back(n);       }       return v;   }   ll dfs(unordered_map<ll,ll> &size,ll node,bool visit[],vector<ll> adj[])   {       visit[node]=true;       ll s=1;       for(int i=0;i<adj[node].size();i++)       {           if(visit[adj[node][i]]==false)           {               s+=dfs(size,adj[node][i],visit,adj);           }       }       size[node]=s;       return size[node];   }   ll node;      void b_f_s(ll visited[],queue<ll> q,ll vertex,vector<ll> v[],vector<ll> adj[])   {       q.push(vertex);       visited[vertex]=1;       while(q.size()>0)       {           node=q.front();           visited[node]=1;           q.pop();           for(ll i=0;i<adj[node].size();i++)           {               if(visited[adj[node][i]]==0)               {                   //visited[adj[node][i]]=1;                   q.push(adj[node][i]);                   v[adj[node][i]]=v[node];                   v[adj[node][i]].push_back(node);               }           }       }   }      void sieve_to_count_primes(ll n)   {       ll is_it_prime[1000001];       for(ll i=1;i<=1000000;i++)       {           is_it_prime[i]=1;       }       for(ll i=2;i<=sqrt(1000000);i++)       {           if(is_it_prime[i]==1)           {               for(ll j=i*i;j<=1000000;)               {                   is_it_prime[j]=0;                   j+=i;               }           }       }   }      ll LIS_Size(vector<ll>& v)   {    if(v.size()==0)       {           return 0;       }    vector<ll> vv(v.size(),0);    ll size=1;    vv[0]=v[0];    for (ll i=1;i<v.size();i++)    {     auto b=vv.begin(),e =vv.begin()+size;     auto iter=lower_bound(b,e,v[i]);     if(iter==vv.begin()+size)     {         vv[size]=v[i];         size++;     }     else     {         *iter=v[i];     }    }    return size;   }         ll sum_in_rational_form_up(ll n,ll ups[],ll downs[],ll Mod)   {    ll ans_down=LCM(downs,n,Mod);    ll ans_up=0;    for (ll j=0;j<n;j++)    {     ans_up=(ans_up+((ups[j])*(ans_down/downs[j])))%Mod;    }    ll g_c_d=gcd(ans_up,ans_down);    ans_up/=g_c_d;    ans_down/=g_c_d;    //cout<<ans_up<<   <<ans_down;    return ((ans_up%Mod)+Mod)%Mod;       //cout<<ans.first<<   <<ans.second;   }      ll sum_in_rational_form_down(ll n,ll ups[],ll downs[],ll Mod)   {    ll ans_down=LCM(downs,n,Mod);    ll ans_up=0;    for (ll j=0;j<n;j++)    {     ans_up=(ans_up+((ups[j])*(ans_down/downs[j])))%Mod;    }    ll g_c_d=gcd(ans_up,ans_down);    ans_up/=g_c_d;    ans_down/=g_c_d;    //cout<<ans_up<<   <<ans_down;    return (ans_down%Mod+Mod)%Mod;       //cout<<ans.first<<   <<ans.second;   }      ll mod_inverse(ll a,ll m)   {       ll GCD=gcd(a,m);       if(GCD==1)       {           return power(a,m-2);       }   }      bool possible(ll ind,vector<ll>& from_left,ll val1,ll val2,vector<ll>& from_right)   {       ll n=from_left.size();       if(ind>=1&&(ind+2)<n)       {           if(val2>=from_left[ind-1]&&((val1-(val2-from_left[ind-1]))==from_right[ind+2]))           {               return true;           }           else           {               return false;           }       }       else if(ind==0)       {           if(((val1-val2)==from_right[ind+2]))           {               return true;           }           else           {               return false;           }       }       else       {           if(((val2-val1)==from_left[ind-1]))           {               return true;           }           else           {               return false;           }       }   }         int main()   {    ios::sync_with_stdio(false);    cin.tie(0);    ll t,n,k,m;       cin>>t;       while(t--)       {           cin>>n;           vector<ll> aa(n);           for(ll i=0;i<n;i++)           {               cin>>aa[i];           }           if(n==2)           {               if(aa[0]==aa[1])               {                   cout<< YES <<endl;               }               else               {                   cout<< NO <<endl;               }           }           else           {               vector<ll> bb(n);               bb=aa;               vector<ll> from_left(n),from_right(n);               from_left[0]=bb[0];               for(ll i=1;i<n;i++)               {                   if(bb[i]<from_left[i-1])                   {                       from_left[i]=LLONG_MIN;                       continue;                   }                   if(from_left[i-1]==LLONG_MIN)                   {                       from_left[i]=LLONG_MIN;                       continue;                   }                   from_left[i]=bb[i]-from_left[i-1];               }               bb=aa;               from_right[n-1]=bb[n-1];               for(ll i=n-2;i>=0;i--)               {                   if(bb[i]<from_right[i+1])                   {                       from_right[i]=LLONG_MIN;                       continue;                   }                   if(from_right[i+1]==LLONG_MIN)                   {                       from_right[i]=LLONG_MIN;                       continue;                   }                   from_right[i]=bb[i]-from_right[i+1];               }               ll f=0;               if(from_left[n-1]==0||from_right[0]==0)               {                   f=1;               }               for(ll i=0;i<n-1;i++)               {                   if(i>=1&&from_left[i-1]==LLONG_MIN)                   {                       continue;                   }                   if(i+2<=(n-1)&&from_right[i+2]==LLONG_MIN)                   {                       continue;                   }                   if(possible(i,from_left,aa[i],aa[i+1],from_right)==true)                   {                       f=1;                       break;                   }               }               if(f==1)               {                   cout<< YES <<endl;               }               else               {                   cout<< NO <<endl;               }              }          }    return 0;   }   