#include<stdio.h>
#include<stdlib.h>
 
typedef struct node 
{
    int data
    struct node*next;
} node;
node*create node(int value) {
node*newnode=(node*)malloc(size of (node));
newnode->data=value;
newnode->next=null;
return newnode;
}
void insert at end(node**head,int value){
node*newnode=create node(value);
if(*head=null){
    *head=newnode;
    return;
}
 node*temp=*head;
 while(temp->next!=null)
 temp=temp->next;
 temp->next=newnode;
}
int delete value (node**head,int val){
    node*temp=*head;
    node*pre=null;
while (temp!=null){
    if(temp->data==value){
    if(pre==null)
    *head=temp->next;
else
  pre->next=temp->next;
  free(temp);
  return 0;
}
void printlist(node*head){
node*temp=head;
while(temp!=null){
printf("%d",tem->data);
if(temp->next!=null)printf(" ");
temp=temp->next;
}
printf("\n");
}
int main (){
    int n,val,x;
    node*head=null;
    if(scanf("%d",&n)!=1){
    printf("Invalid input\n");
    return 0;
    }
if(n<0||n>1000){
    print("Invalid input\n");
    return 0;
}
for(int i=0;i<n;i++){
    if(scanf("%d",&x)!=1){
        printf("Invalid input\n");
        return o;
    }
insert end )(// editor4
#include <stdio.h>
#include <stdlib.h>

typedef struct Node {
    int data;
    struct Node *next;
} Node;

Node* createNode(int value) {
    Node* newNode = (Node*)malloc(sizeof(Node));
    newNode->data = value;
    newNode->next = NULL;
    return newNode;
}

void insertEnd(Node** head, int value) {
    Node* newNode = createNode(value);
    if (*head == NULL) {
        *head = newNode;
        return;
    }
    Node* temp = *head;
    while (temp->next != NULL)
        temp = temp->next;
    temp->next = newNode;
}

int deleteValue(Node** head, int val) {
    Node* temp = *head;
    Node* prev = NULL;
    while (temp != NULL) {
        if (temp->data == val) {
            if (prev == NULL)
                *head = temp->next;
            else
                prev->next = temp->next;
            free(temp);
            return 1; 
        }
        prev = temp;
        temp = temp->next;
    }
    return 0;
}

void printList(Node* head) {
    Node* temp = head;
    while (temp != NULL) {
        printf("%d", temp->data);
        if (temp->next != NULL) printf(" ");
        temp = temp->next;
    }
    printf("\n");
}

int main() {
    int n, val, x;
    Node* head = NULL;

    if (scanf("%d", &n) != 1) {
        printf("Invalid input\n");
        return 0;
    }

    if (n < 0 || n > 1000) {
        printf("Invalid input\n");
        return 0;
    }

    for (int i = 0; i < n; i++) {
        if (scanf("%d", &x) != 1) {
            printf("Invalid input\n");
            return 0;
        }
        insertEnd(&head, x);
    }

    if (scanf("%d", &val) != 1) {
        printf("Invalid input\n");
        return 0;
    }

    if (deleteValue(&head, val)) {
        if (head == NULL)
            printf("List is empty\n");
        else
            printList(head);
    } else {
        printf("Value not found\n");
    }

    return 0;
}





























    
}