You are given an integer array A of size N. You are also given Q queries. In each query, you are given three integers L, R, and D respectively.
You are required to determine the length of the largest contiguous segment in the indices range [L,R] of A that forms an arithmetic progression with a common difference of D.
Note: The segment whose length is 1 always forms an arithmetic progression of a common difference D.
Input format
Output format
Print Q lines representing the answer such as the ith line denotes the answer for the ith query.
Constraints
1≤N≤200000
1≤Ai≤200000
−200000≤D≤200000
For the first query, [1,2,3] forms an AP with difference 1.
For the second query, [5] forms an AP.