#include
using namespace std;
int main() {
int n,m,k,s,max;
cin >> n >>m>>k>>s;
char a[n][m];
if(n<=100&&n>0&&m<=100&&m>0)
{
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin >> a[i][j];
}
}
}
if(s<=100&&s>0&&k<=100&&k>0)
{
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
if(a[i][j]==’*’)
{if(s>=1)
s+=4;
else
break;
}
if(a[i][j]==’.’)
{if(s>=1)
s-=3;
else
break;
}
if(a[i][j]=='#')
{ if(i!=n-1)
{
if(s>0)
{
s-=1;
j=m;
}
}
else
break;
}
if(j==(m-1))
{ if(s>0)
max=s;
else
break;
}
}
}
if(max>=k&&s>=0)
{
cout << “Yes” << endl;
cout << max;
}
else{
cout << “No”;
}
}
return 0;
}
Respected sir
kindly tell the logic error in this code of piyush and magical park as according to my code answer is 24 but your answer is 31?? I have saved the code on online ide,