Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use dynamic programming to store number of subsequences up till index <code>i</code> with GCD <code>g1</code> and <code>g2</code>.
Solve with full IDE support and test cases