2 test cases are not satisfying

#include<bits/stdc++.h>
using namespace std;
int main() {
int m,n,k,s,i,j,flag=1;
cin>>m>>n>>k>>s;
char a[m][n];
for(i=0;i<m;i++)
for(j=0;j<n;j++)
cin>>a[i][j];
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
if(a[i][j]==’#’)
break;
if(a[i][j]==’.’&&j!=n-1)
{
s=s-3;
}
else if(a[i][j]==’.’&&j==n-1)
{
s=s-2;
}
if(s<k)
{
flag=0;
i=m;
j=n;
break;
}
if(a[i][j]==’’&&j!=n-1)
{
s=s+4;
}
else if(a[i][j]==’
’&&j==n-1)
{
s=s+5;
}
}
}
if(flag==0)
cout<<β€œNo”;
else
cout<<β€œYes”;
return 0;
}
i dont know whats wrong in the code i am getting wrong answer in 2 test cases but 3 test cases are showing as correct

Hi @ArshjitSingh
At the end when piyush gets out of the park then along with yes you need to print s also. So just print s in next line when you are printing β€œYes”.

Here is your corrected code :

If your doubt is clear then mark it as resolved.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.