codeparrot/codecomplex huggingface dataset:
// Problem: 908_C. New Year and Curling
// Time complexity: quadratic
/*
ID: andrew42
LANG: JAVA
TASK: 
PROG: 
*/

import java.io.*;
import java.util.*;
import java.lang.*;

public class curling {
	public static void main(String[] args) throws IOException {
		Scanner input = new Scanner(System.in);
		int numD = input.nextInt();
		double rad = input.nextInt();
		int[] xC = new int[numD];
		for (int i = 0; i < numD; i++){
			xC[i] = input.nextInt();
		}
		double[] maxY = new double[1001];
		for (int i = 0; i < numD; i++){
			double h = rad;
			for (int j = Math.max(1, xC[i]-(int)(2*rad)); j <= Math.min(1000, xC[i]+2*rad); j++){
				if (maxY[j] > 0){
					h = Math.max(h, Math.sqrt(4*rad*rad-(j-xC[i])*(j-xC[i]))+maxY[j]);
				}
			}
			System.out.print(h + " ");
			maxY[xC[i]] = h;
		}
	}
}
// Problem: 908_C. New Year and Curling
// Time complexity: quadratic
import java.io.*;
import java.util.StringTokenizer;

public class Main {
    static double [] res;
    static double r;
    static double solve (int xMe, int xHim, int idxHim) {
        if (Math.abs(xMe - xHim) > 2 * r) return r;
        double hisY = res[idxHim];
        double lo = hisY, hi = hisY + 2 * r, best = hi;
        for (int cnt = 0; cnt <= 50; cnt++) {
            double myY = (lo) + ((hi - lo) / 2);
            if (notIntersect(xMe, myY, xHim, hisY)) {
                best = Math.min(best, myY);
                hi = Math.max(lo, myY);
            } else
                lo = Math.min(hi, myY);
        }
        return best;
    }
    static boolean notIntersect (double x1, double y1, double x2, double y2) {
        return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) >= 2 * r  * 2 * r;
    }
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        res = new double[n];
        r = sc.nextInt();
        int[] x = new int[n];
        for (int i = 0; i < n; i++)
            x[i] = sc.nextInt();

        for (int i = 0; i < n; i++) {
            double max = r;
            for (int j = 0; j < i; j++) {
                max = Math.max(max, solve(x[i], x[j], j));
            }
            if (i > 0) out.print(" ");
            res[i] = max;
            out.printf("%.10f", max);
        }
        out.println();

        out.flush();
        out.close();
    }
    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

        public Scanner(FileReader s) throws FileNotFoundException {	br = new BufferedReader(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();}
    }
}
// Problem: 908_C. New Year and Curling
// Time complexity: quadratic
import java.util.*;
import java.io.*;
public class probC {
	static int r;
	static ArrayList<Circ> curr = new ArrayList<Circ>();
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		r = sc.nextInt();
		int[] xC = new int[n];
		for(int i = 0; i < n; i++)
			xC[i] = sc.nextInt();
		double ans[] = new double[n];
		ans[0] = r;
		curr.add(new Circ(xC[0], r));
		for(int i = 1; i < n; i++) {
			double max = r;
			for(int k = 0; k < curr.size(); k++) {
				double cur = curr.get(k).y+ Math.sqrt(4 * r*r - (xC[i]-curr.get(k).x)*(xC[i]-curr.get(k).x));
				//System.out.println(cur + " " + max);
				if(4 * r*r - (xC[i]-curr.get(k).x)*(xC[i]-curr.get(k).x) >= 0)
					max = Math.max(cur,  max);
			}
			ans[i] = max;
			curr.add(new Circ(xC[i], max));
			//System.out.println();
		}
		for(int i = 0; i < n; i++)
			System.out.print(ans[i] + " ");
		sc.close();
	}
	static class Circ {
		double x, y;
		public Circ(double a, double b) {
			x=a;
			y=b;
		}
		public boolean isNT(Circ b) {
			double dist = Math.sqrt((x-b.x)*(x-b.x)+(y-b.y)*(y-b.y));
			return dist > 2*r;
		}
	}
}
// Problem: 908_C. New Year and Curling
// Time complexity: quadratic

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.*;


public class Main {


    public static void main(String[] args) throws IOException{
        Scanner sc = new Scanner();
        PrintWriter out = new PrintWriter(System.out);

        int N = sc.nextInt(), R = sc.nextInt();
        double answer[] = new double[N];
        int[] x = new int[N];

        for (int i = 0; i < N; i++)
            x[i] = sc.nextInt();

        for (int i = 0; i < N; i++) {
            answer[i] = R;
            for (int j = 0; j < i; j++) {
                int dist = Math.abs(x[i] - x[j]);
                if(dist <= 2 * R) {
                    double t = answer[j] + Math.sqrt(4 * R * R - dist * dist);
                    answer[i] = Math.max(answer[i], t);
                }
            }
        }
        for(int i = 0; i < N; ++i)
            out.print(answer[i] + " ");

        out.println();

        out.flush();
        out.close();
    }


    static class Scanner {
        BufferedReader br;
        StringTokenizer st;

        Scanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

    }
    }
// Problem: 908_C. New Year and Curling
// Time complexity: quadratic

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Created by mostafa on 12/29/17.
 */
public class C {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt(), r = sc.nextInt();
        int[] x = new int[n];
        for(int i = 0; i < n; i++)
            x[i] = sc.nextInt();
        double[] ans = new double[n];
        for(int i = 0; i < n; i++) {
            ans[i] = r;
            for(int j = 0; j < i; j++) {
                int d = Math.abs(x[i] - x[j]);
                if(d > 2 * r)
                    continue;
                int h = 2 * r;
                double yd = Math.sqrt(h * h - d * d);
                ans[i] = Math.max(ans[i], ans[j] + yd);
            }

            out.print(ans[i]);
            if(i == n - 1)
                out.println();
            else
                out.print(" ");
        }

        out.flush();
        out.close();

    }

    static class Scanner {
        BufferedReader br; StringTokenizer st;
        Scanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while(st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

    }
}
// Problem: 908_C. New Year and Curling
// Time complexity: quadratic
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.abs;
import static java.lang.Math.max;
import static java.lang.Math.sqrt;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Locale;
import java.util.StringTokenizer;

public class C {

	static int sqr(int x) {
		return x * x;
	}

	static void solve() throws Exception {
		int n = scanInt();
		int r = scanInt();
		int x[] = new int[n];
		double y[] = new double[n];
		for (int i = 0; i < n; i++) {
			int cx = x[i] = scanInt();
			double cy = r;
			for (int j = 0; j < i; j++) {
				if (abs(cx - x[j]) <= 2 * r) {
					cy = max(cy, y[j] + sqrt(sqr(2 * r) - sqr(cx - x[j])));
				}
			}
			y[i] = cy;
			if (i > 0) {
				out.print(' ');
			}
			out.printf(Locale.US, "%.9f", cy);
		}
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}
// Problem: 908_C. New Year and Curling
// Time complexity: quadratic
import java.util.Scanner;

public class TaskC {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), r = sc.nextInt();
		int[] xcords = new int[n];
		double[] ycords = new double[n];
		double y = r, x = 0, px = 0, ty = 0;
		for(int i = 0; i < n; i++) {
			xcords[i] = sc.nextInt();
			x = xcords[i];
			y = r;
			for(int j = 0; j < i; j++) {
				px = xcords[j];
				if(Math.abs(px - x) > r*2) continue;	
				ty = Math.sqrt(4*r*r - (x-px)*(x-px)) + ycords[j];
				y = Math.max(y, ty);
			}
			ycords[i] = y;
		}
		for(int i = 0; i < n; i++) {
			System.out.print(ycords[i] + " ");
		}
	}

}
// Problem: 908_C. New Year and Curling
// Time complexity: quadratic
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public class C {
	public static void main(String[] args) throws IOException {
		FastScanner in= new FastScanner(System.in);
		PrintWriter out= new PrintWriter(System.out);
		
		int n= in.nextInt();
		int r= in.nextInt();
		int [] x= new int[n];
		for (int i = 0; i < x.length; i++) {
			x[i]= in.nextInt();
		}
		double [] res= new double[n];
		res[0]= r;
		for (int i = 1; i < x.length; i++) {
			boolean found = false;
			for (int j = 0; j < i; j++) {
				double dis= Math.abs(x[i]-x[j]);
				double rr= 4.0*r*r-1.0*dis*dis;
				if(rr>=0) {
					double del= Math.sqrt(rr);
					res[i]= Math.max(res[i], res[j]+del);
					found= true;
				}
			}
			if(!found) {
				res[i]= r;
			}
		}
		for (int i = 0; i < res.length; i++) {
			out.print(res[i]+" ");
		}
		out.close();
		
	}
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
			st = new StringTokenizer("");
		}

		public String next() throws IOException {
			if (!st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
				return next();
			}
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		public double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
	}
}
// Problem: 908_C. New Year and Curling
// Time complexity: quadratic
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class C908 {
	
	public static class mPoint implements Comparable<mPoint> {
		public double a, b;
		public mPoint(int a, double b) {
			this.a = a; this.b = b;
		}
		public int compareTo(mPoint p) {
			return b < p.b ? 1 : (b > p.b) ? -1 : 0;
		}
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(), r = in.nextInt();
		int[] ar = new int[n];
		ArrayList<mPoint> disks = new ArrayList<>();
		double[] ans = new double[n];
		for (int i = 0; i < n; i++) {
			ar[i] = in.nextInt();
			double max = -1;
			for (int j = 0; j < disks.size(); j++) {
				if (inRange(ar[i], disks.get(j).a, r)) {
					double h = 4*r*r - (ar[i]-disks.get(j).a) * (ar[i]-disks.get(j).a);
					max = Math.max(max, Math.sqrt(h) + disks.get(j).b);
				}
			}
			mPoint p = null;
			if (max == -1) {
				p = new mPoint(ar[i], r);
			} else {
				p = new mPoint(ar[i], max);
			}
			disks.add(p);
			ans[i] = p.b;
		}
		for (int i = 0; i < ans.length - 1; i++) {
			System.out.print(ans[i] + " ");
		}
		System.out.println(ans[ans.length - 1]);
	}
	
	public static boolean inRange(int a, double b, int r) {
		if (Math.abs(b - a) <= 2*r) return true; return false;
	}
	
}
// Problem: 908_C. New Year and Curling
// Time complexity: quadratic
import java.util.*;

public class C {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int n, r;
        n = scan.nextInt();
        r = scan.nextInt();

        int[] locs = new int[n];

        for (int i = 0; i < n; i++) {
            locs[i] = scan.nextInt();
        }

        double[] yPos = new double[n];
        Arrays.fill(yPos, 10e100);

        yPos[0] = r;
        for (int i = 1; i < n; i++) {
            double pos = r;
            for (int j = 0; j < i; j++) {
                int xDist = Math.abs(locs[i] - locs[j]);
                if (xDist <= 2 * r) {
                    double y = (2.0 * r) * (2.0 * r) - (xDist * xDist);
                    if (Math.abs(y - 0.0) < 0.0000000001) {
                        y = 0;
                    } else {
                        y = Math.sqrt(y);
                    }
                    y += yPos[j];
                    pos = Math.max(pos, y);

                } else {
                    continue;
                }
            }
            yPos[i] = pos;
        }
        String[] ans = new String[n];

        for (int i = 0; i < n; i++) {
            ans[i] = "" + yPos[i];
        }

        System.out.println(String.join(" ", ans));

    }
}
// Problem: 908_C. New Year and Curling
// Time complexity: quadratic

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class C {
	static int n,r,x[];
	static double ans[];
	public static void main(String args[]) throws IOException
	{
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		n = sc.nextInt();
		r = sc.nextInt();
		x = new int[n];
		ans = new double[n];
		for (int i=0;i<n;i++)
			x[i] = sc.nextInt();
		for (int i=0;i<n;i++)
		{
			ans[i] = r;
			for (int j=0;j<i;j++)
			{
				if (Math.abs(x[i]-x[j])>2*r)
					continue;
				int deltaxsq = (x[i]-x[j])*(x[i]-x[j]);
				int deltaysq = 4 * r * r - deltaxsq;
				double deltay = Math.sqrt(deltaysq);
				ans[i] = Math.max(ans[i], ans[j]+deltay);
			}
			pw.print(ans[i]+" ");
		}
		pw.flush();
		pw.close();
	}
	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 boolean ready() throws IOException {return br.ready();}
	
	
	}
}
// Problem: 908_C. New Year and Curling
// Time complexity: quadratic
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class GB17C {
	public static void main(String[] args) throws NumberFormatException, IOException {
			
			BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
			
			String[] dir = sc.readLine().split(" ");
			int n = Integer.parseInt(dir[0]);
			int r = Integer.parseInt(dir[1]);
			
			String[] t = sc.readLine().split(" ");
			int[] list = new int[n];
			for(int x=0; x<n; x++){
				list[x] = Integer.parseInt(t[x]);
			}
			
			double[] yCoords = new double[n];
			
			for(int x=0; x<n; x++){
				double stop = (double)r;
				int dist = 2*r;
				int xCoordNew = list[x];
				
				
				for(int y=0; y<x; y++){
					
					int xCoordOld = list[y];
					if(Math.abs(xCoordNew - xCoordOld) == dist){
						stop = Math.max(stop, yCoords[y]);
					}
					else if(Math.abs(xCoordNew - xCoordOld) < dist){
						double extra = Math.pow((double)(dist*dist) - (double)((xCoordNew - xCoordOld)*(xCoordNew - xCoordOld)), 0.5);  
						
						stop = Math.max(stop, yCoords[y] + extra);
					}
				}
				
				yCoords[x] = stop;
				System.out.print(stop+" ");
			}
			
			
	}
}


/* 

BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));

int n = Integer.parseInt(sc.readLine());
String[] t = sc.readLine().split(" ");
int[] list = new int[n];
for(int x=0; x<n; x++){
	list[x] = Integer.parseInt(t[x]);
}
		
String[] dir = sc.readLine().split(" ");
int a = Integer.parseInt(dir[0]);
int b = Integer.parseInt(dir[1]);
int c = Integer.parseInt(dir[2]);
int d = Integer.parseInt(dir[3]);
int e = Integer.parseInt(dir[4]);

int n = Integer.parseInt(sc.readLine());

*/
// Problem: 908_C. New Year and Curling
// Time complexity: quadratic
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.*;

public class C {
  public static void main(String[] args) {
    FastScanner sc = new FastScanner();

    int n = sc.nextInt();
    long r = sc.nextInt();
    double d = 2 * r;
    long[] xs = sc.readLongArray(n);
    P[] points = new P[n];
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < n; i++) {
      if (i > 0) sb.append(' ');
      double y = r;
      for (int j = 0; j < i; j++) {
        long diff = Math.abs(xs[i] - points[j].x);
        if (diff <= 2 * r) {
          double dy = Math.sqrt(d * d - diff * diff);
          double testY = points[j].y + dy;
          y = Math.max(y, testY);
        }
      }

      sb.append(y);
      points[i] = new P(xs[i], y);
    }
    System.out.println(sb);
  }

  static class P {
    final long x;
    final double y;

    public P(long x, double y) {
      this.x = x;
      this.y = y;
    }
  }

  static void shuffle(int[] arr) {
    Random rng = new Random();
    int length = arr.length;
    for (int idx = 0; idx < arr.length; idx++) {
      int toSwap = idx + rng.nextInt(length - idx);
      int tmp = arr[idx];
      arr[idx] = arr[toSwap];
      arr[toSwap] = tmp;
    }
  }

  public static class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    public FastScanner(Reader in) {
      br = new BufferedReader(in);
    }

    public FastScanner() {
      this(new InputStreamReader(System.in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String readNextLine() {
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }

    int[] readIntArray(int n) {
      int[] a = new int[n];
      for (int idx = 0; idx < n; idx++) {
        a[idx] = nextInt();
      }
      return a;
    }

    long[] readLongArray(int n) {
      long[] a = new long[n];
      for (int idx = 0; idx < n; idx++) {
        a[idx] = nextLong();
      }
      return a;
    }
  }
}
// Problem: 908_C. New Year and Curling
// Time complexity: quadratic
/*
 * code together
 * code better
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	
	
	static int x[]=new int[1005];
	static double ans[]=new double[1005];
	static int nn,r;
	public static void main(String[] args) throws IOException {
		StreamTokenizer in=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		Scanner sc=new Scanner(System.in);
		int huiwoqingchun=0;
		nn=sc.nextInt();
		r=sc.nextInt();
		for(int i=1;i<=nn;i++) {
			x[i]=sc.nextInt();
		}
		//HashMap<, V>
		ans[1]=r;
		int lajitimu=0;
		for(int i=2;i<=nn;i++) {
			ans[i]=r;
			for(int j=1;j<i;j++) {
				if(Math.abs(x[j]-x[i])>2*r)
					continue;
				ans[i]=Math.max(ans[i], ans[j]+Math.sqrt(4*r*r-(x[j]-x[i])*(x[j]-x[i])));
			}
		}
		double buzhidaoganma=0;
		for(int c=1;c<=nn;c++)
			System.out.printf("%.12f ",ans[c]);
	}
}
// Problem: 908_C. New Year and Curling
// Time complexity: quadratic
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.Vector;
public class naloga1{
	static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter out=new PrintWriter(System.out);
	public static void main(String[] args) throws Exception{
		StringTokenizer st=new StringTokenizer(in.readLine());
		int n=Integer.parseInt(st.nextToken());
		int r=Integer.parseInt(st.nextToken());
		int[] x=new int[n];
		st=new StringTokenizer(in.readLine());
		for(int i=0;i < n;i++){
			x[i]=Integer.parseInt(st.nextToken());
		}
		sim a=new sim(n,r);
		for(int i:x) {
			a.add(i);
		}
		for(double d:a.cy) {
			out.print(d+" ");
		}
		out.println();
		out.close();
	}
}
class sim{
	double[]cx;
	int[]ccx;
	double[]cy;
	int count;
	int n;
	int r;
	sim(int nn,int rr){
		r=rr;
		n=nn;
		cx=new double[n];
		ccx=new int[n];
		cy=new double[n];
		count=0;
	}
	void add(int x) {
		double lowest=r;
		for(int i=0;i<count;i++) {
			if(Math.abs(ccx[i]-x)<=2*r) {
				double dy=Math.sqrt(4*r*r-(ccx[i]-x)*(ccx[i]-x));
				lowest=Math.max(lowest,cy[i]+dy);
			}
		}
		ccx[count]=x;
		cy[count]=lowest;
		cx[count++]=x;
	}
}