Language: C++

#include <cstdio>
#include <iostream>
int num[1005][1005],h,w,n;
pair<int,int>p;
int main(){
while(1){
scanf("%d %d %d",&h,&w,&n);
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++){
scanf("%d",&num[j][i]);
}
}
int y=1,s=1,cou=0;
while(1){
cou++;
if(num[y][s]){
y++;
num[y][s]=(num[y][s]+1)%2;
if(y==w+1){
p=make_pair(y,s);
break;
}}else{
num[y][s]=(num[y][s]+1)%2;
s++;
if(s==h+1){
p=make_pair(y,s);
break;
}
}
if(cou==n){
cout << p.first << " " << p.second << endl; return 0;
}
if(p.first==1 && p.second==h){
cout << p.first <<" "<< p.second << endl; return 0;
}
if(p.first==w && p.second==1){
cout << p.first <<" "<<p.second <<endl; return 0;
}
}
}
}

Compiler output:
a.cc:4:1: error: 'pair' does not name a type
    4 | pair<int,int>p;
      | ^~~~
a.cc: In function 'int main()':
a.cc:20:1: error: 'p' was not declared in this scope
   20 | p=make_pair(y,s);
      | ^
a.cc:20:3: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   20 | p=make_pair(y,s);
      |   ^~~~~~~~~
      |   std::make_pair
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:26:1: error: 'p' was not declared in this scope
   26 | p=make_pair(y,s);
      | ^
a.cc:26:3: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   26 | p=make_pair(y,s);
      |   ^~~~~~~~~
      |   std::make_pair
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:31:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   31 | cout << p.first << " " << p.second << endl; return 0;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:31:9: error: 'p' was not declared in this scope
   31 | cout << p.first << " " << p.second << endl; return 0;
      |         ^
a.cc:31:39: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   31 | cout << p.first << " " << p.second << endl; return 0;
      |                                       ^~~~
      |                                       std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:33:4: error: 'p' was not declared in this scope
   33 | if(p.first==1 && p.second==h){
      |    ^
a.cc:34:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   34 | cout << p.first <<" "<< p.second << endl; return 0;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:34:37: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   34 | cout << p.first <<" "<< p.second << endl; return 0;
      |                                     ^~~~
      |                                     std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:36:4: error: 'p' was not declared in this scope
   36 | if(p.first==w && p.second==1){
      |    ^
a.cc:37:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   37 | cout << p.first <<" "<<p.second <<endl; return 0;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:37:35: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   37 | cout << p.first <<" "<<p.second <<endl; return 0;
      |                                   ^~~~
      |                                   std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~