Divisible subarrays

Unable to pass testcase 1 and 4
Link to the code