Problem:
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Cross Points of Circles

For given two circles $c1$ and $c2$, print the coordinates of the cross points of them.

Input

The input is given in the following format.

$c1x\; c1y\; c1r$

$c2x\; c2y\; c2r$

$c1x$, $c1y$ and $c1r$ represent the coordinate and radius of the first circle.
$c2x$, $c2y$ and $c2r$ represent the coordinate and radius of the second circle.
All input values are given in integers.

Output

Print the coordinates ($x1$, $y1$) and ($x2$, $y2$) of the cross points $p1$ and $p2$ respectively in the following rules.

If there is one cross point, print two coordinates with the same values.

Print the coordinate with smaller $x$ first. In case of a tie, print the coordinate with smaller $y$ first.

The output values should be in a decimal fraction with an error less than 0.000001.

Constraints

The given circle have at least one cross point and have different center coordinates.

$-10,000 \leq c1x, c1y, c2x, c2y \leq 10,000$

$1 \leq c1r, c2r \leq 10,000$

Sample Input and Output

Sample Input 1

0 0 2
2 0 2

Sample Output 1

1.00000000 -1.73205080 1.00000000 1.73205080

Sample Input 2

0 0 2
0 3 1

Sample Output 2

0.00000000 2.00000000 0.00000000 2.00000000

Solution in C# (judge verdict: Wrong Answer)

using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');
    Vector2 centerPointA = new Vector2(decimal.Parse(input[0]), decimal.Parse(input[1]));//受け取った入力をdecimalに変換
    decimal radiusA = decimal.Parse(input[2]);
    string[] inputa = Console.ReadLine().Split(' ');
    Vector2 centerPointB = new Vector2(decimal.Parse(inputa[0]), decimal.Parse(inputa[1]));//受け取った入力をdecimalに変換
    decimal radiusB = decimal.Parse(inputa[2]);

    Vector2[] answers = new Vector2[2];
    answers = Vector2.CircleIntersection(centerPointA, radiusA, centerPointB, radiusB);

    Console.WriteLine(answers[0].x + " " + answers[0].y + " " + answers[1].x + " " + answers[1].y);
	}
}

class Vector2//2次元ベクトル
{
static decimal EPS = 1e-10m;//小数誤差比較

  public Vector2 (decimal X, decimal Y)
  {
    this.x = X;
    this.y = Y;
  }

  public decimal x {private set; get;}
  public decimal y {private set; get;}

  public static Vector2 operator + (Vector2 ob1, Vector2 ob2)//ベクトルの基本演算
  {
    return new Vector2 (ob1.x + ob2.x, ob1.y + ob2.y);
  }
  public static Vector2 operator - (Vector2 ob1, Vector2 ob2)
  {
    return new Vector2 (ob1.x - ob2.x, ob1.y - ob2.y);
  }
  public static Vector2 operator * (Vector2 ob, decimal scalar)
  {
    return new Vector2 (ob.x * scalar, ob.y * scalar);
  }
  public static Vector2 operator * (decimal scalar, Vector2 ob)
  {
    return new Vector2 (ob.x * scalar, ob.y * scalar);
  }
  public static Vector2 operator / (Vector2 ob, decimal scalar)
  {
    return new Vector2 (ob.x / scalar, ob.y / scalar);
  }

  public decimal Length()//ベクトルの長さの2乗
  {
    return x * x + y * y;
  }
  public static decimal Distance(Vector2 ob1, Vector2 ob2)//2点間の距離
  {
    return (decimal)Math.Sqrt((double)((ob1.x-ob2.x) * (ob1.x-ob2.x) + (ob1.y-ob2.y) * (ob1.y-ob2.y)));
  }
  public static decimal DotProduct(Vector2 ob1, Vector2 ob2)//内積
  {
    return ob1.x * ob2.x + ob1.y * ob2.y;
  }
  public static decimal CrossProduct(Vector2 ob1, Vector2 ob2)//外積。第2引数が反時計回り側で正。
  {
    return ob1.x * ob2.y - ob1.y * ob2.x;
  }
  public static decimal Arg(Vector2 p)//x軸に対する偏角
  {
    return (decimal)Math.Atan2((double)p.y, (double)p.x);
  }
  public static Vector2 PoralCoordinate(decimal radius, decimal angle)//長さと座標から極座標にする
  {
    return new Vector2(radius * (decimal)Math.Cos((double)angle), radius * (decimal)Math.Sin((double)angle));
  }

  public static Vector2 Projection(Vector2 beginPoint, Vector2 endPoint, Vector2 point)//点の射影
  {
    Vector2 segment = endPoint - beginPoint;
    decimal ratio = Vector2.DotProduct(point - beginPoint, segment) / segment.Length();
    return beginPoint + segment * ratio;//始点にたす
  }

public static long WhereVector(Vector2 beginPoint, Vector2 endPoint, Vector2 point)
  {//ベクトルに対する点の位置
    Vector2 segment = endPoint - beginPoint;
    Vector2 aimVec = point - beginPoint;
    if(Vector2.CrossProduct(segment, aimVec) > EPS)
      return 1;//反時計回り側
    else if(Vector2.CrossProduct(segment, aimVec) < -EPS)
      return 2;//時計回り側
    else if(Vector2.DotProduct(segment, aimVec) < -1+EPS)
      return 3;//ベクトル反対向きの側
    else if(segment.Length() < aimVec.Length())
      return 4;//ベクトル向きの側
    else
      return 5;//ベクトル上
  }

  public static Vector2 IntersectPoint(Vector2 vecA, Vector2 vecB, 
    Vector2 vecAsub, Vector2 vecBsub)//2線分の交点
  {
    Vector2 leftPoint = Vector2.Projection(vecA, vecB, vecAsub);//線分左端点の射影
    Vector2 rightPoint = Vector2.Projection(vecA, vecB, vecBsub);//線分右端点の射影
    decimal leftLength = (vecAsub - leftPoint).Length();
    decimal rightLength = (vecBsub - rightPoint).Length();

    leftLength = (decimal)(Math.Sqrt((double)leftLength));
    rightLength = (decimal)(Math.Sqrt((double)rightLength));
    
    if(leftLength < EPS) return leftPoint;
    else if(rightLength < EPS) return rightPoint;
    decimal ratio = leftLength / (leftLength + rightLength);
    return (leftPoint + ratio * (rightPoint - leftPoint));
  }

public static Vector2[] circleLineIntersection(Vector2 centerPoint, decimal circleRadius, 
    Vector2 beginPoint, Vector2 endPoint)//円と直線の交点
  {
    Vector2[] answers = new Vector2[2];
    Vector2 segment = endPoint - beginPoint;
    Vector2 unitSegment = segment / (decimal)Math.Sqrt((double)segment.Length());
    Vector2 circleProjection = Projection(beginPoint, endPoint, centerPoint);//交点の中点
    decimal lineLength = 
      (decimal)Math.Sqrt((double)(circleRadius*circleRadius - (circleProjection-centerPoint).Length()));//端点と中点の距離
    //Console.WriteLine(unitSegment.x+" "+unitSegment.y);
    answers[0] = circleProjection + (unitSegment * lineLength);
    answers[1] = circleProjection - (unitSegment * lineLength);
    return answers;
  }

  public static Vector2[] CircleIntersection(Vector2 centerPointA, decimal circleRadiusA, 
      Vector2 centerPointB, decimal circleRadiusB)//2円の交点
    {
      Vector2[] answers = new Vector2[2];
      decimal centerDistance = Distance(centerPointA, centerPointB);//2円の中心間距離
      decimal centerAngle = Arg(centerPointB - centerPointA);
      decimal intersectionAngle = (decimal)Math.Acos((double)(circleRadiusA*circleRadiusA
        + centerDistance*centerDistance - circleRadiusB*circleRadiusB)
        /(double)(2*circleRadiusA*centerDistance));//余弦定理
      answers[0] = centerPointA + PoralCoordinate(circleRadiusA, centerAngle+intersectionAngle);
      answers[1] = centerPointA + PoralCoordinate(circleRadiusA, centerAngle-intersectionAngle); 
      if(answers[0].x > answers[1].x || answers[0].x - answers[1].x < EPS && answers[0].y > answers[1].y)
      {
        Vector2 swapMemo = answers[0];
        answers[0] = answers[1];
        answers[1] = swapMemo;
      }
      return answers; 
    }
}