Language: C++

#include<bits/stdc++.h>
using namespace std;
char c[107][107];
int n,m,k,pi,pj,a[107][107],mn=10000;
bool vis[107][107];
int uint(int a,int b){
	if(a%b!=0)return a/b+1;else return a/b;
}
void dfs(int p,int i,int j){
	if(c[i][j]=='#')return;
	if(p==0)return;
	if(vis[i][j])return;
	else vis[i][j]=1;
	mn=min(mn,uint(a[i][j],k));
	dfs(p-1,i+1,j);
	dfs(p-1,i,j+1);
	dfs(p-1,i-1,j);
	dfs(p-1,i,j-1);
}
int main(){
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++){
		scanf("%s",c[i]);
		for(int j=0;j<m;j++){
			if(c[i][j]=='S'){
				pi=i;
				pj=j;
			}
			a[i][j]=min(i-1,j-0);
		}
	}
	memset(vis,0,sizeof(vis));
	dfs(k,pi,pj);
	cout<<mn+1;
	return 0;
}

Compiler output:
a.cc:6:21: error: 'int uint(int, int)' redeclared as different kind of entity
    6 | int uint(int a,int b){
      |                     ^
In file included from /usr/include/stdlib.h:514,
                 from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/sys/types.h:150:22: note: previous declaration 'typedef unsigned int uint'
  150 | typedef unsigned int uint;
      |                      ^~~~
a.cc: In function 'void dfs(int, int, int)':
a.cc:14:33: error: expression list treated as compound expression in functional cast [-fpermissive]
   14 |         mn=min(mn,uint(a[i][j],k));
      |                                 ^
a.cc:14:15: error: no matching function for call to 'min(int&, uint)'
   14 |         mn=min(mn,uint(a[i][j],k));
      |            ~~~^~~~~~~~~~~~~~~~~~~~
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:   template argument deduction/substitution failed:
a.cc:14:15: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'uint' {aka 'unsigned int'})
   14 |         mn=min(mn,uint(a[i][j],k));
      |            ~~~^~~~~~~~~~~~~~~~~~~~
/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, 2 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:   candidate expects 1 argument, 2 provided
/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:   template argument deduction/substitution failed:
a.cc:14:15: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   14 |         mn=min(mn,uint(a[i][j],k));
      |            ~~~^~~~~~~~~~~~~~~~~~~~