Vs code giving right output but your website terminal isn't approving the testcase

User
include <stdio.h>

int main() {
int t;

do{
scanf("%d", &t);
}while(t<1||t>1000);

while (t--) {
    int n;
    do{
    scanf("%d", &n);
    }
    while(n<2||n>100000);
    int a[n];

    for (int i = 0; i < n; i++) {
        do{
        scanf("%d", &a[i]);
        }while(a[i]<1||a[i]>1000);
    }
    int largest=a[0],slargest=0;
    
    for(int i=1;i<n;i++){
        if(a[i]>largest){
            slargest=largest;
            largest=a[i];
            }
        else if(a[i]>slargest && a[i] != largest){
            slargest=a[i];
        }
    }
    printf("%d\n",largest+slargest);
}

return 0;

}

my vs code shows 3 but your terminal shows i got 4 but the correct code is 3 and expected also 3