HELP! Run Time Error on all test cases

What is wrong with the codE? Please HELP!!

Send me the code, nonetheless, technique is
take two pointers, both at head, move on of them k steps ahead
now move both together until the first one becomes null, at this point, wherever the other pointer was, that is kth from the end

#include
using namespace std;
class Node {
public:
int data;
Node* next;
Node(int d) {
data = d;
}
};
void insert(Node* head, int d) {
if (head == NULL) {
head = new Node(d);
head->next = NULL;
return;
}
Node* temp = head;
while (temp->next) {
temp = temp->next;
}
Node* n = new Node(d);
temp->next = n;
n->next = NULL;
}
void print(Node head) {
Node
temp = head;
while (temp) {
cout << temp->data << " ";
temp = temp->next;
}
}

int main() {
Node* head = NULL;
int n; cin >> n;
while (n–) {
int d; cin >> d;
insert(head, d);
}
int k; cin >> k;
Node* slow = head;
Node* fast = head;
while (k–)
fast = fast->next;
while (fast) {
fast = fast->next;
slow = slow->next;
}
cout << slow->data;
}

it is very hard to read a code like this
can u please give me the ide link?

Thank you very much. :’)