source_code: 
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.io.PrintWriter;
  import java.util.Arrays;
  import java.util.StringTokenizer;
  
  public class C {
  	public static void main(String[] args) throws IOException {
  		Scanner sc = new Scanner(System.in);
  		int n = sc.nextInt();
  		int r = sc.nextInt();
  		int[] arr = new int[n];
  		for (int i = 0; i < n; i++)
  			arr[i] = sc.nextInt();
  
  		double[] ans = new double[n];
  
  		for (int i = 0; i < n; i++) {
  			double max = 0;
  			for (int j = 0; j < i; j++) {
  				int difx = Math.abs(arr[i] - arr[j]);
  				if (difx <= 2 * r) {
  					max = Math.max(max, ans[j] + Math.sqrt(4 * r * r - difx * difx));
  				}
  			}
  			ans[i] = max;
  		}
  		PrintWriter pw = new PrintWriter(System.out);
  		for (int i = 0; i < n; i++)
  			pw.print(ans[i] + r + " ");
  		pw.flush();
  	}
  
  	static class Scanner {
  		StringTokenizer st;
  		BufferedReader br;
  
  		public Scanner(InputStream s) {
  			br = new BufferedReader(new InputStreamReader(s));
  		}
  
  		public String next() throws IOException {
  			while (st == null || !st.hasMoreTokens())
  				st = new StringTokenizer(br.readLine());
  			return st.nextToken();
  		}
  
  		public int nextInt() throws IOException {
  			return Integer.parseInt(next());
  		}
  
  		public long nextLong() throws IOException {
  			return Long.parseLong(next());
  		}
  
  		public String nextLine() throws IOException {
  			return br.readLine();
  		}
  
  		public double nextDouble() throws IOException {
  			return Double.parseDouble(next());
  		}
  
  		public boolean ready() throws IOException {
  			return br.ready();
  		}
  	}
  }
  