Score : $600$ points
Given a sequence $A$ of $N$ numbers, answer the following $Q$ questions.
Here, a positive integer $x$ is said to be a cubic number when there is a positive integer $y$ such that $x=y^3$.
Input is given from Standard Input in the following format:
$N$ $Q$ $A_1$ $A_2$ $\dots$ $A_N$ $L_1$ $R_1$ $L_2$ $R_2$ $\vdots$ $L_Q$ $R_Q$
Print $Q$ lines.
The $i$-th line should contain Yes
if, in the $i$-th question, $A_{L_i} \times A_{L_i+1} \times \dots \times A_{R_i}$ is a cubic number, and No
otherwise.
The checker is case-insensitive; output can be either uppercase or lowercase.
8 5 7 49 30 1 15 8 6 10 1 2 2 3 4 4 5 8 3 8
Yes No Yes No Yes