For this Question: To enter Todo's amusement park, there are M counters. Total N people want to enter the amusement park, each of whom will line up in front of one of the counters. Any counter worker gets angry if the number of people lining up in front of him is at least 2 more than the number of people lining up in front of any of its neighbouring counters. The worker at the K-th counter works the fastest. 
Find the maximum number of people that can line up in front of the K-th counter such that each counter gets at least one person and no counter worker is angry.Input contains three integers M, N and K.

Constraints:
1 <= N <= 1000000000
1 <= M <= N
1 <= K <= MPrint the maximum number of people that can line up in front of the Kth counter such that each counter gets at least one person and no counter worker is angry.Sample Input 1
3 3 1

Sample Output 1
1

Explanation: Optimal Arrangement is 1 1 1.

Sample Input 2
3 6 1

Sample Output
3

Explanation: Optimal Arrangement is 3 2 1., I have written this Solution Code: import java.io.*;


class Main {
	public static void main (String[] args) throws NumberFormatException, IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String[] s = in.readLine().split(" ");
        in.close();
        int M = Integer.parseInt(s[0]);
        int N = Integer.parseInt(s[1]);
        int K = Integer.parseInt(s[2]);
        if(M>=N)
            System.out.println(1);
        else if(M == 1)
            System.out.println(N);
        else
            System.out.println(countersAndLines(M, N, K));
	}
    static int countersAndLines (int m, int n, int k){
        int start = n/m, end = (n/2)+1;
        while(start<=end){
            int mid = start+(end-start)/2;

            long minPeople = option(mid, k) + option(mid, m-k+1) - mid;
            if(minPeople == n)
                return mid;
            else if(minPeople < n)
                start = mid+1;
            else
                end = mid-1;
        }
        return end;
    }
    static long sum (int m, int k, int i){
        long sum = i;
        int temp = --i;

        for(int j = k-1; j>=1; j--){
            if(i <= 1)
                sum += 1;
            else{
                sum += i;
                i--;
            }
        }
        for(int j = k+1; j<=m; j++){
            if(temp <= 1)
                sum += 1;
            else{
                sum += temp;
                temp--;
            }
        }
        return sum;
    }
    static long option(int i, int k){
        long x = k;
	    if(x > i)
            x = i;
	    k -= x;
        long y = k + x * (2 * i - x + 1) / 2;
	    return y;
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?