Sir, I have a doubt in question (Coprime triples) using mobius function

Only 9 out of 15 test cases are passed.

ques link : https://www.codechef.com/problems/COPRIME3

mysol : https://ide.geeksforgeeks.org/LkExOYZobG

@S18CRX0029
There are few mistakes in your code. I am pointing out them, please correct them

  1. Increase the size of N to 1000001 otherwise your code won’t work for ai=1000000
  2. You haven’t called cal_mobius() function in int_main()
  3. See line no. 59, your n in num_coprime() function is maximum possible value not the number of element in list. It will give segmentation fault it maximum possible value is greater than number of elements in array.

@S18CRX0029
I have updated your code as per above mention problems. Here is the updated code, it is working fine for all testcases now.
https://ide.codingblocks.com/s/254127

@S18CRX0029
Please mark this doubt as resolved if you don’t have any other doubt regarding this question.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.