Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		strNums := strings.Fields(scanner.Text())
		nums := []int{}
		for _, strNum := range strNums {
			num, _ := strconv.Atoi(strNum)
			nums = append(nums, num)
		}
		a := nums[0]
		b := nums[1]
		c := nums[2]
		d := nums[3]
		e := nums[4]
		f := nums[5]
		lcm := lcm(a, d)
		mulA := lcm / a
		mulD := lcm / d
		a *= mulA
		b *= mulA
		c *= mulA
		d *= mulD
		e *= mulD
		f *= mulD

		if d < 0 {
			d *= -1
			e *= -1
			f *= -1
		}

		bE := b - e
		cF := c - f
		y := float64(cF) / float64(bE)
		x := (float64(c) - (y * float64(b))) / float64(a)

		if x == 0 {
			fmt.Printf("%.3f ", 0.0)
		} else {
			fmt.Printf("%.3f ", x)
		}
		if y == 0 {
			fmt.Printf("%.3f\n", 0.0)
		} else {
			fmt.Printf("%.3f\n", y)
		}
	}
}

C++: #include <iostream>
#include <stdio.h>
using namespace std;

int main() {
	double a, b, c, d, e, f;
	double x, y;
	double det;
	while (cin >> a >> b >> c >> d >> e >> f) {
		det = a * e - b * d;
		x = (e * c - b * f) / det;a
		y = (-d * c + a * f) / det;
		printf("%.3f %.3f\n", x, y);
	}
}

C++: #include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define fi first
#define se second
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return M_PI;
}
typedef set<int> set_i;
typedef set<string> set_s;
int main(){
	double a,b,c,d,e,f,a1;
	while(cin>>a>>b>>c>>d>>e>>f){
		double x,y;
		a1=a;
		a=a*d;
		b=b*d;
		c=c*d;
		d=d*a1;
		e=e*a1;
		f=f*a1;
		y=(c-f)/(b-e);
		x=(f-e*y)/d;
		if(x==0) x=0;
		if(y==0) y=0;
		printf("%.3lf %.3lf\n",x,y);
	}
}

C++: #include <stdio.h>
 
double xxx(double a, double b, double c, double d, double e, double f){
 
if(b!=1.000){
a=a/b;
c=c/b;
b=1.000;
}
 
a=a*e;
b=b*e;
c=c*e;
 
a=a-d;
b=b-e;
c=c-f;
 
return c/a;
 
}
 
double yyy(double a, double b, double c, double d, double e, double f){
 
if(a!=1.000){
b=b/a;
c=c/a;
a=1.000;
}
 
a=a*d;
b=b*d;
c=c*d;
 
a=a-d;
b=b-e;
c=c-f;
 
return c/b;
 
}
 
 
int main(void){
 
double a, b, c, d, e, f;
 
while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f)!=-1){
 
printf("%.3f %.3f\n", xxx(a, b, c, d, e, f), yyy(a, b, c, d, e, f));
 
}
 
return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <stdio.h>
#include <cstdlib>
using namespace std;


int main(void){

  int a;
  int b;
  int c;
  int d;
  int e;
  int f;

  float x;
  float y;

  while(scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f)!=EOF){
    x = a * e - b * d ;
    y = b * d - a * e ;

    if ((x == 0) && (y == 0)){
      cerr << "error" << endl;
      exit(1);
    }else if(x == 0){
      cerr << "error" << endl;
      exit(1);
    }else if(y == 0){
      cerr << "error" << endl;
      exit(1);
    }else{

      if(c * e - b * f == 0){
        x = 0;
      }else{
        x = ( c * e - b * f ) / x ;
      }

      if(c * d - a * f == 0){
        y = 0;
      }else{
        y = ( c * d - a * f) / y;
      }

      printf("%.3f %.3f\n",x,y);
    }
  }


  return 0;


}

C++: #include <stdio.h>
int main(void)
{
  float a,b,c,d,e,f,x,y;
  while(scanf("%f%f%f%f%f%f",&a,&b,&c,&d,&e,&f) != EOF){
  	x=(c*e-b*f)/(a*e-b*d);
  	y=(c*d-a*f)/(b*d-a*e);
	if(x>=0){
		x+=0.0004;
	}
	else{
		x-=0.0004;
	}
	if(y>=0){
		y+=0.0004;
	}
	else{
		y-=0.0004;
	}
	printf("%.3f %.3f\n",x,y);
  }
  return(0);
}

C++: #include <iostream>
#include <iomanip>
using namespace std;

int main() {
	int cnt = 0;
	int a[200], b[200], c[200], d[200], e[200], f[200];
	double x[200], y[200];

	while(cin >> a[cnt] >> b[cnt] >> c[cnt] >> d[cnt] >> e[cnt] >> f[cnt]) cnt++;

	for(int i=0; i<cnt; i++) {
		if(a[i] != 0 && b[i] != 0 && d[i] != 0 && e[i] != 0) {
			x[i] = (b[i]*f[i]-e[i]*c[i])/(b[i]*d[i]-a[i]*e[i]);
			y[i] = (d[i]*c[i]-a[i]*f[i])/(b[i]*d[i]-a[i]*e[i]);
		} else {
			if(a[i] == 0) {
				y[i] = c[i]/b[i];
				x[i] = (f[i]-e[i]*y[i])/d[i];
			} else if(b[i] == 0) {
				x[i] = c[i]/a[i];
				y[i] = (f[i]-d[i]*x[i])/e[i];
			} else if(d[i] == 0) {
				y[i] = f[i]/e[i];
				x[i] = (c[i]-b[i]*y[i])/a[i];
			} else if(e[i] == 0) {
				x[i] = f[i]/d[i];
				y[i] = (c[i]-a[i]*x[i])/b[i];
			}
		}
	}

	for(int i=0; i<cnt; i++) cout << fixed << setprecision(3) << x[i] << " " << y[i] << endl;

	return 0;
}

C++: import numpy
#while True:
#   try:
#       a,b,c,d,e,f = (int(i) for i in input().split())
#        x,y = [numpy.dot(numpy.linalg.inv(numpy.array([[a,b],[d,e]])),numpy.array([c,f]))[0],numpy.dot(numpy.linalg.inv(numpy.array([[a,b],[d,e]])),numpy.array([c,f]))[1]]
#        print("{0:.3f} {1:.3f}".format(x,y))
#   except EOFError:
#       break

C++: #include <iostream>
#include <iomanip>
using namespace std;

int main(){
	double a, b, c, d, e, f;
	cout << setprecision(3) << setiosflags(ios::fixed);

	while(cin >> a >> b >> c >> d >> e >> f){
		cout << (c*e-b*f)/(a*e-b*d)+0.00001 << " " << (c*d-a*f)/(b*d-a*e)+0.0001 << endl;
	}

	return 0;

}

C++: #include <iostream>
#include <iomanip>
using namespace std;
int main() {
    double a, b, c, d, e, f;
    while(cin >> a) {
        cin >> b >> c >> d >> e >> f;
        double x = (c * e - b * f) / (a * e - b * d);
        double y = (-c * d + a * f) / (a * e - b * d);
        cout << fixed << setprecision(3) << x << " " << y << endl;
    }
    return 0;
}

C++: #include <stdio.h>
#include <math.h>

int main(){
  int i = 0;
  while(1){
  i++;
  int a, b, c, d, e, f;
  scanf("%d ",&a);
  scanf("%d ",&b);
  scanf("%d ",&c);
  scanf("%d ",&d);
  scanf("%d ",&e);
  scanf("%d ",&f);
  
  double x, y;
  x = (double)(c*e-b*f) / (double)(a*e-b*d);
  y = (double)(a*f-c*d) / (double)(a*e-b*d);
  x = (double)round(x*10000.0) / 10000.0;
  y = (double)round(y*10000.0) / 10000.0;
  printf("%.3f %.3f\n", x, y);
  
  if(scanf("%d", &a)==EOF) break;
  else{
    int line = i * 6
    fseek(STDIN, lineL, SEEK_SET);
  }
  }
  
  return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;

int main()
{
	double a, b, c, d, e, f, x, y;			// ax + by = c 
											// dx + ey = f
	while (cin >> a >> b >> c >> d >> e >> f)
	{
		x = (double)((c*e - b*f) / (a*e - b*d));
		y = (double)((a*f - c*d) / (a*e - b*d));
		printf("%1.3f %1.3f\n", x, y);
	}
}

C++: #include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;

int main() {
	double a, b, c, d, e, f, x, y;
	while(cin >> a >> b >> c >> d >> e >> f){
		x = (c*e-b*f)/(a*e-b*d);
		y = (c*d-a*f)/(b*d-a*e);
		if (fabs(x) < 1e-3) x = 0;
		if (fabs(y) < 1e-3) y = 0;
		printf("%.3f %.3f\n", x, y);
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
using namespace std;

int main(void){
	double a,b,c,d,e,f;
	double x,y;

	while(cin >> a >> b >> c >> d >> e >> f){
		x = (b*f-e*c)/(b*d-a*e);
		y = (a*f-d*c)/(a*e-b*d);
		printf("%.3lf %.3lf\n",x,y);
	}

}

C++: #include <iostream>
#include <iomanip>
#include <utility>

int main(){
  while(true){
    double a, b, c, d, e, f;
    std::cin >> a >> b >> c >> d >> e >> f;
    if(std::cin.eof()) return 0;

    double x, y;
    if(a==0){
      std::swap(a,d);
      std::swap(b,e);
      std::swap(c,f);
    }
    double s=d/a;
    d-=a*s; e-=b*s; f-=c*s;
    y=f/e;
    x=(-b*y+c)/a;

    std::cout << std::fixed;
    std::cout << std::setprecision(3) << x << " " << std::setprecision(3) << y << std::endl;
  }
}