Problem:
Score: 100 points

Problem Statement

In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year.

For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year.

In this country, a date is called Takahashi when the month and the day are equal as numbers. For example, 5-5 is Takahashi.

How many days from 2018-1-1 through 2018-a-b are Takahashi?

Constraints

a is an integer between 1 and 12 (inclusive).

b is an integer between 1 and 31 (inclusive).

2018-a-b is a valid date in Gregorian calendar.

Input

Input is given from Standard Input in the following format:

a b

Output

Print the number of days from 2018-1-1 through 2018-a-b that are Takahashi.

Sample Input 1

5 5

Sample Output 1

5

There are five days that are Takahashi: 1-1, 2-2, 3-3, 4-4 and 5-5.

Sample Input 2

2 1

Sample Output 2

1

There is only one day that is Takahashi: 1-1.

Sample Input 3

11 30

Sample Output 3

11

There are eleven days that are Takahashi: 1-1, 2-2, 3-3, 4-4, 5-5, 6-6, 7-7, 8-8, 9-9, 10-10 and 11-11.

Solution in C# (Mono 4.6.2.0) (judge verdict: Runtime Error)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int a, b;
            a = int.Parse(str[0]); 
            b = int.Parse(str[1]);

            string[,] map  = new string[a,b];

            for (int i =0; i < a ; i++)
            {
               string stra = Console.ReadLine();
                for (int ii = 0; ii < b ; ii++)
                {
                    map[i, ii] = stra.Substring(ii, 1);
                }
            }

            bool flag = false;

            if(map[0,0] == "#")
            {
                if(map[0,1] == "." && map[1,0] == ".")
                {
                    flag = true;
                }
            }
            if (map[0, b-1] == "#")
            {
                if (map[0, b-2] == "." && map[1, b-1] == ".")
                {
                    flag = true;
                }
            }
            if (map[a-1, 0] == "#")
            {
                if (map[a-2, 0] == "." && map[a-1, 1] == ".")
                {
                    flag = true;
                }
            }
            if (map[a-1, b-1] == "#")
            {
                if (map[a-2, b-1] == "." && map[a-1, b-2] == ".")
                {
                    flag = true;
                }
            }

            for(int i = 1; i < b-1; i++)
            {
                if (map[0, i] == "#")
                {
                    if (map[0, i - 1] == "." && map[1, i] == "." && map[0, i + 1] == ".")
                    {
                        flag = true;
                    }
                }
            }
            for (int i = 1; i < b - 1; i++)
            {
                if (map[a-1, i] == "#")
                {
                    if (map[a-1, i - 1] == "." && map[a-2, i] == "." && map[a-1, i + 1] == ".")
                    {
                        flag = true;
                    }
                }
            }
            for (int i = 1; i < a - 1; i++)
            {
                if (map[i, 0] == "#")
                {
                    if (map[i-1, 0] == "." && map[i, 1] == "." && map[i+1,1] == ".")
                    {
                        flag = true;
                    }
                }
            }
            for (int i = 1; i < a - 1; i++)
            {
                if (map[i, b-1] == "#")
                {
                    if (map[i - 1, b-1] == "." && map[i, b-2] == "." && map[i + 1, b-1] == ".")
                    {
                        flag = true;
                    }
                }
            }

            for (int i = 1; i < a - 1 ; i++)
            {
                for (int ii = 1; ii < b - 1; ii++)
                {
                    
                    if(map[i,ii] == "#")
                    {
                        if (map[i -1 ,ii] == "." && map[i + 1,ii] == "." && map[i,ii-1] == "." && map[i, ii + 1] == ".")
                        {
                            flag = true;
                        }
                    }

                }
            }
            if (flag)
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
        }
    }
}