function [Czzz,t_time] = HOS_will(y,MM)

%y: Contaminated EEG
%MM：the size of the sliding window

Nc=floor(MM);
Czzz=zeros(length(y),1); 
%caculating the third-order-statistics
t_time=0;
tic;
% maxlag=2;
t_time=t_time+toc;
for jz=1:length(y)-Nc+1
    sig3cum=CUM3EST(y(jz:jz+Nc-1),0,Nc,0,'biased',0);
    if mod(Nc,2)==1
        MM0=floor(Nc/2);
    else
        MM0=floor(Nc/2);
    end
    Czzz(jz+MM0)=sig3cum;
end
t_time=t_time+toc;
if jz==1                            
    Czzz(1:MM0)=Czzz(jz+MM0);
end
if jz==length(y)-MM+1
    Czzz(jz:length(y))=Czzz(jz+MM0);
end
