c – How to end this program with EOF?

He was solving a problem on the UriOnlineJudge site and was asked to enter with EOF. I made the code perfectly, with the exception that I do not know how to implement the EOF tally. How can I do it?

# include 

int main (void) {noun
int n, Q, i, and[101], the[101], d, j, m = -1, n;
scanf ("% d% d", & N, & Q);

for (i = 0; i <101; i ++) {
Y[i] = 0;
the[i] = 0;
}


(i = 1, i <= N, i ++) {
scanf ("% d", & y[i]);
}
(i = 1, i <= N, i ++) {
for (j = 1; j<=N;j++){
            if (e[j]>m) {
and m =[j];
n = j;
}
}
the[i]= M;
Y[n]= -2;
m = -1;
}
(i = 1, i <= Q, i ++) {
scanf ("% d", & d);
printf ("% d  n", the file[d]);
}
return 0;
}