watching.cpp: In function 'bool check(int)':
watching.cpp:10:33: error: 'j' was not declared in this scope
for(int i=1, x=1, y=1; i<=n; ++j){
^
watching.cpp: In function 'int main()':
watching.cpp:22:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d %d", &n, &p, &q);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
watching.cpp:23:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
for(int i=1; i<=n; ++i) scanf("%d", &a[i]);
~~~~~^~~~~~~~~~~~~