Help me find the error in my code

 #include <stdio.h>
    int main(void) {
    	// your code goes here
    	int input, size;
    	scanf("%d %d", &size, &input);
    	int A[size];
    	for(int i = 0; i < size; i++)
    	{
    	    scanf("%d", &A[i]);
    	}
    	int check = -1;
    		for(int i = 0; i < size; i++)
    	{
    	    if(A[i] == input)
    	    {
    	        check = check + 2;
    	    }
    	}
    	printf("%d\n", check);
    	return 0;
    }

Codechef shows it as wrong answer, but giving custom inputs shows exactly the output that was required. Iā€™m confused

Consider the test input:

2 2
2 2
2 Likes

Oh yes, I assumed every element will be unique. My bad.
Thanks!

2 Likes

Input
4 4
4 4