foo.cc: In function 'int main()':
foo.cc:35:7: warning: init-statement in selection statements only available with -std=c++1z or -std=gnu++1z
    if(x==x1;y==y1) break;
       ^
foo.cc:35:8: warning: statement has no effect [-Wunused-value]
    if(x==x1;y==y1) break;
       ~^~~~
foo.cc:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d",&M,&N,&K);
  ~~~~~^~~~~~~~~~~~~~~~~~~
foo.cc:23:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&p[i][j]);
    ~~~~~^~~~~~~~~~~~~~~