Divisible subarray


the 2nd case is failing

sorry its the 3rd case thats failing

Hi,

Consider the case of p[0]. You are leaving a case of taking the subarray from start point to a particular index in this case. In this case you should add m*(m-1)/2 + m to the answer.

i still don’t understand what your trying to say
could you explain again

Consider long long datatype and try to submit.

Actually you have taken that case which i was telling. Just change datatype to long long and try to submit.

i have made the changes yet the 3rd case is failing

Change the datatype of ans and m to long long it will get accepted.