Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using P=pair<int,int>;
int inf=1e9;
queue<P> que;
vector<int>dx={0,0,1,-1};
vector<int>dy={1,-1,0,0};

int main(){
	int h,w,k;cin>>h>>w>>k;
	vector<string>a(h);
	for(auto&& u:a)cin>>u;
	vector<vector<int>>d(h,vector<int>(w,inf));
	rep(i,h)rep(j,w)if(a[i][j]=='S'){que.push(i,j);d[i][j]=0;}
	while(!que.empty()){
		P z=que.top();que.pop();
		rep(i,4){
			int x,y;x=z.first+dx[i];y=z.second+dy[i];
			if(x<0||x>=h||y<0||y>=h)continue;
			if(d[x][y]==inf){
				d[x][y]=d[z.first][z.second]+1;
				que.push(make_pair(x,y));
		}			

	}	
	int mn=inf;
	rep(i,h)mn=min({mn,d[i,0],d[i,w-1]});
	rep(i,w)mn=min({mn,d[0,i],d[h-1,i]});
	cout<<(mn-1)/k+1<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:50: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(int&, int&)'
   15 |         rep(i,h)rep(j,w)if(a[i][j]=='S'){que.push(i,j);d[i][j]=0;}
      |                                          ~~~~~~~~^~~~~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; value_type = std::pair<int, int>]'
  283 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:283:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; value_type = std::pair<int, int>]'
  288 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:288:7: note:   candidate expects 1 argument, 2 provided
a.cc:17:25: error: 'class std::queue<std::pair<int, int> >' has no member named 'top'; did you mean 'pop'?
   17 |                 P z=que.top();que.pop();
      |                         ^~~
      |                         pop
a.cc:28:23: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   28 |         rep(i,h)mn=min({mn,d[i,0],d[i,w-1]});
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
a.cc:28:23: note:   deduced conflicting types for parameter '_Tp' ('int' and 'std::vector<int>')
   28 |         rep(i,h)mn=min({mn,d[i,0],d[i,w-1]});
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided
a.cc:29:23: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   29 |         rep(i,w)mn=min({mn,d[0,i],d[h-1,i]});
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
a.cc:29:23: note:   deduced conflicting types for parameter '_Tp' ('int' and 'std::vector<int>')
   29 |         rep(i,w)mn=min({mn,d[0,i],d[h-1,i]});
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided
a.cc:31:2: error: expected '}' at end of input
   31 | }
      |  ^
a.cc:10:11: note: to match this '{'
   10 | int main(){
      |           ^