# APRIL20B Squared Subsequences SQRDSUB

IT IS ASKED IN APRIL LONG CHALLENGE 2020 (Squared Subsequences)

I AM ASSUMING HERE can be written as a difference of square of two number if it remainder on modulo of 4 is either 0,1,3 .

As in editorial it is given the number is good if it is odd or multiple of 4.
i think both logic are same.
i solved using the first method but getting WA
WHAT I S WRONG WITH THIS CODE. PLZ HELP

#include <bits/stdc++.h>
#define vp vector< pair<long long,long long> >
#define ll long long
#define pb push_back
#define mod 1000000007
#define endl â\nâ
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main()
{
fast_io
ll t;cin>>t;
while(tâ)
{
ll n;
cin>>n;
ll a[n];
for(ll i=0;i<n;i++){
cin>>a[i];
a[i]=a[i]%4;
}
ll dp[n][4];
//memset(dp,0,sizeof(dp));

`````` for(ll i=0;i<n;i++){
for(ll j=0;j<4;j++){
dp[i][j]=0;
}
}

dp[0][a[0]%4]=1;
for(ll i=1;i<n;i++){
dp[i][a[i]%4]=1;
for(int j=0;j<4;j++){
if(dp[i-1][j]>0){
ll cnt=dp[i-1][j];
ll newinc=((j%4)*(a[i]%4))%4;
dp[i][newinc]+=dp[i-1][j];
}
}
}
ll ans=0;
for(ll i=0;i<n;i++){
for(ll j=0;j<4;j++){
if(j!=2){
ans+=dp[i][j];
}
}
}
cout<<ans<<endl;

}
``````

}