Help me in solving CNDY problem

My issue

the code i have written is correct the output is also got matched but while submitting it showing runtime error

My code

#include <stdio.h>
#include <stdlib.h>

int isValid(int arr[], int n) {
    int count[1000001] = {0};
    for (int i = 0; i < 2 * n; i++) {
        count[arr[i]]++;
        if (count[arr[i]] > 2) {
            return 0;
        }
    }
    return 1;
}

int main() {
    int T;  
    scanf("%d", &T);

    while (T--) {
        int N;
        scanf("%d", &N);

        int arr[2 * N];
        for (int i = 0; i < 2 * N; i++) {
            scanf("%d", &arr[i]);
        }

        if (isValid(arr, N)) {
            printf("Yes\n");
        } else {
            printf("No\n");
        }
    }

    return 0;
}

Learning course: Roadmap to 3*
Problem Link: https://www.codechef.com/learn/course/klu-roadmap-3star/KLURMP300A/problems/CNDY