Test case 1 giving MLE other all passed

#include
using namespace std;
class node{

public:
	long long int  data;
	node *next;
	
node(long long int   value){
	data=value;
	next=NULL;
}

};

void insertAt_tail(node*&head,long long value){
if(head==NULL){
head= new node(value);
return;
}
node n=new node(value);
node
temp=head;
while(temp->next!=NULL){
temp=temp->next;
}
temp->next=n;
}

void print(node head){
while(head!=NULL){
cout<data<<" ";
head=head->next;
}
}
node * append(node * head,long long k){
node
slow=head;
node* fast=head;
long long count=0;
while(count<k){
fast=fast->next;
count++;
}
while(fast->next!=NULL){
fast=fast->next;
slow=slow->next;
}
node *n=slow->next;
slow->next=NULL;
fast->next=head;
return n;
}

int main(){
node* head=NULL;
long long n,k,a;
cin>>n;

for( long long int i=0;i<n;i++){
	cin>>a;
	insertAt_tail(head,a);
	
}
cin>>k;
if(k>=n){
	k=k%n;
}
head=append(head,k);
print(head);


return 0;

}

hi @kumawatnitesh093 handle the case when k = 0

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.