Piyush and magical (my all test cases does not passes

import java.util.;
public class Main {
public static void main(String args[]) {
// Your Code Here
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int k = sc.nextInt();
int s = sc.nextInt();
if(n>=1 && m>=1 && k>= 1 && s>=1 && n<=100 && m<=100 && k<=100 && s<=100)
{
char[][] arr = new char[n][m];
for(int i =0 ; i<n ; i++)
{
for(int j = 0 ; j < m ; j++)
{
arr[i][j] = sc.next().charAt(0);
}
}
System.out.print(piymagic(arr,k,s));
}
}
public static int piymagic(char[][] arr ,int k , int s)
{
String str = β€œYes”;
for(int i = 0 ; i<arr.length; i++)
{
for(int j =0 ; j<arr[i].length ; j++)
{
if(arr[i][j] == β€˜.’)
{
if(s>k)
{
s = s -3;
}
else
{
str = β€œNo”;
return s;
}
}
if(arr[i][j] == '
’)
{
if(s>k)
{
s = s +4;
}
else
{
str = β€œNo”;
return s;
}
}
if(arr[i][j] == β€˜#’)
{
if(s>k)
{
s = s -1;
break;
}
else
{
str = β€œNo”;
return s;
}
}
}
s= s+1;
}
System.out.println(str);
return s;
}
}

@mayanktiwari6957 Lemme take a look buddy!

@mayanktiwari6957 why are yor complicating the logic bro, it is straight forward question, clearly mentioned if answer is β€œNo” you don’t have to print any integer just β€œNO”. Read the question carefully.
Here is your simplified code