Help me in solving DSAAGP08 problem

My issue

Code fault not found

My code

#include <stdio.h>

void deleteElement(int arr[], int *size, int pos) {
    // Ensure position is valid
    if (pos < 0 || pos >= *size) {
        printf("Invalid position!\n");
        return;
    }

    // Shift elements one position to the left
    for (int i = pos; i < *size - 1; i++) {
        arr[i] = arr[i + 1];
    }

    // Decrease the size of the array
    (*size)--;

    // Optional: To show the updated array
    printf("Array after deletion: ");
    for (int i = 0; i < *size; i++) {
        printf("%d ", arr[i]);
    }
    printf("\n");
}

int main() {
    int arr[] = {10, 20, 30, 40, 50};  // Example array
    int size = 5;  // Initial size of the array

    int pos;
    printf("Enter the position of the element to delete (0 to %d): ", size - 1);
    scanf("%d", &pos);

    deleteElement(arr, &size, pos);

    return 0;
}

Learning course: BCS301: Data structures
Problem Link: https://www.codechef.com/learn/course/abesit-dsa/ABESITDS05/problems/DSAAGP08