Queries Regarding Floyd's Circle

Below is the code for floyds cycle, I am not able to understand how to give input for the floyd cycle and how break the chain by making the prev pointer NULL, below is the code that I tried-

https://hack.codingblocks.com/app/contests/1281/1307/problem

u can run ur code here
and u need to remove the cycle as well

Can you please make the necessary changes in the code that I have sent, it would help me to clearly understand the code.

image

image

update made in breakthecycle function
detect cycle is fine

call the breakthecycle function

I have made the changes in the above code but still it is not compiling. It is showing the error time limit exceeded(on Hackerblocks).

bool floydCycleRemoval(Node *head)
{
    Node*slow = head;
    Node*fast = head;

    while(fast!=NULL && fast->next!=NULL)
    {
        fast=fast->next->next;///Taking 2 steps
        slow=slow->next;///Taking 1 step

        if(fast==slow)
        {
            slow=head;
            while(slow->next!=fast->next)  // here i am sorry in previous photo i wrote == 
// it should be slow->next != fast->next
            {

                fast=fast->next;
                slow=slow->next;
            }
            fast->next=NULL;
            return true;  // add return true
        }
    }
    return false;  //return false since return type is bool

}