Logic Checking (Provide Corner test cases if Possible)

I have implemented the code used the same logic as mentioned in the editorial ran a few test cases by hand and they all give expected results but test cases don’t pass. Please help.

Code Link: https://ide.codingblocks.com/s/84622

n=21715947 k=888741

your output = 3619320

correct output =1539

Approach:

First take the squareroot of k and store it in a variable say, m.
Run the loop from i=2 to m.
If i = m then copy k to i.
If k is divisible by i then divide k by i.
Run a loop to n and add the quotient to a varible say, u.
Store the minimum value of r after every loop.

Can you please explain it?
i did the same thing the editorial mentioned same logic if there is some error in the code can you please point it out?

finding factor function is wrong check your code with this input

1
10000 12345678

run your code in this input and see factors of k

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.