407969: GYM102953 6 Favorite Product
Description
You have an array $$$a$$$ consisting of $$$n$$$ integers. Your favorite number is $$$k$$$, and you want to see if you can find any triple of distinct indices with a product of $$$k$$$. In other words, you're looking for three distinct indices $$$x$$$, $$$y$$$, and $$$z$$$, such that $$$a_x * a_y * a_z = k$$$.
InputThe first line of input contains two space separated integers $$$n$$$ $$$(1 <= n <= 10^5)$$$ and $$$k$$$ $$$(1 <= k <= 10^5)$$$.
The next line consists of $$$n$$$ space-separated integers: the array $$$a$$$ $$$(1 <= a_i <= 10^4)$$$.
OutputOutput a single positive integer representing the number of triples of distinct indices in $$$a$$$ that have a product of $$$k$$$.
ScoringSubtask 1 (4 points): $$$n <= 100$$$
Subtask 2 (8 points): $$$n <= 2000$$$
Subtask 3 (26 points): no additional constraints
ExamplesInput5 24 6 2 3 4 1Output
2Input
7 7 1 1 1 7 7 7 8Output
9Input
6 27 1 3 3 3 3 9Output
8