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 := cF / bE
		x := (c - (y * b)) / a

		fmt.Printf("%d.000 ", x)
		fmt.Printf("%d.000\n", y)
	}
}

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

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

	while (1) {
		cin>>a>>b>>c>>d>>e>>f;
		if (cin.eof()) break;

		x = (f/e-c/b)/((-a/b)-(-d/e));
		y = (-a/b)*x+c/b;

		cout<<setprecision(3)<<setiosflags(ios::fixed)<<x+0.0005<<" "<<y+0.0005<<endl;
	}

	return 0;
}

C++: #include<cstdio>
using namespace std;
int main(){
	double matrix[4],ans[2];
	while(scanf("%lf %lf %lf %lf %lf %lf",&matrix[0],&matrix[1],&ans[0],&matrix[2],&matrix[3],&ans[1]) != EOF){
		double t = matrix[0]*matrix[3]-matrix[1]*matrix[2];
		printf("%.3lf %.3lf\n",(matrix[3]*ans[0]-matrix[1]*ans[1])/t,(-matrix[2]*ans[0]+matrix[0]*ans[1])/t);
	}
	return 0;
}

C++: #include <stdio.h>
long double a, b, c, d, e, f, x, y;
int main() {
	while (~scanf("%Lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f)) {
		x = (c * e - b * f) / (a * e - b * d);
		y = (a * f - c * d) / (a * e - b * d);
		printf("%.3Lf %.3Lf\n", x, y);
	}
	return 0;
}

C++: #include<stdio.h>

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

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


int main(void) {
    int a, b, c, d, e, f;
    double 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);
        
        printf("%.3lf %.3lf", x, y);
        cout << endl;
    }
}

C++: #include <iostream>
#include <vector>
#include <map>

using namespace std;

int main()
{
int a,b,c,d,e,f;
double A[2][2];
double B[2];
double inv_A[2][2];
while(~scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)){
int det = a*e-b*d;
A[0][0]=a; A[0][1] = b;
A[1][0]=d; A[1][1] = e;
B[0] = c;
B[1] = f; 

inv_A[0][0]=1.0/(double)det *A[1][1]; inv_A[0][1]=1.0/(double)det *-A[0][1];
inv_A[1][0]=1.0/(double)det *-A[1][0]; inv_A[1][1]=1.0/(double)det *A[0][0];

double res[2];
res[0]=0;
res[1]=0;

for(int i=0;i<2;i++){
for(int j=0;j<2;j++){
for(int k=0;k<2;k++){
res[i]+=inv_A[j][k]*B[k];
}
}
}

printf("%.3f %.3f\n",res[0],res[1]);
}
}

C++: #include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
#define N 2
 
using namespace std;
typedef vector< vector<double> > Equation;
 
int main()
{ 
    Equation c(N, vector<double>(N + 1));

	while (cin)
	{
		// input
		for (int i = 0; i < N; ++i)
			for (int j = 0; j < N + 1; ++j)
				cin >> c[i][j];

		// Gaussian elimination
		// 1. Forward elimination
        for (int i = 0; i < N - 1; ++i)
            for (int j = i + 1; j < N; ++j)
            {
                double d = c[j][i] / c[i][i];
                for (int k = i + 1; k <= N; ++k)
                    c[j][k] -= c[i][k] * d;
            }
 
		// 2. Back substitution
        for (int i = N - 1; i >= 0; --i)
        {
            double d = c[i][N];
            for (int j = i + 1; j < N; ++j)
                d -= c[i][j] * c[j][N];
            c[i][N] = d / c[i][i];
        }
	
		double x = c[0][N];
		double y = c[1][N];

		if (abs(x) < 0.001) x = abs(x);
		if (abs(y) < 0.001) y = abs(y);

		printf("%.3lf %.3lf\n", x, y);
	}
 
    return 0;
}

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

double RoundOff(double src, int keta);

int main(void)
{
	int a,b,c,d,e,f,i;
	double ans[2];
	
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=EOF)
	{
		ans[1] = (double)((a*f-d*c)/(-1*d*b+a*e));
		ans[0] = (double)((c-b*ans[1])/a);
		
		for(i=0;i<2;i++)
		{
			printf("%.3f ",RoundOff(ans[i],4.0));
		}
		printf("\n");
	}
	
	return 0;
}

double RoundOff(double src, int keta)
{
	// 10^keta 
	src *= pow(10.0, (double)(keta-1));
	if(src>0){
		// (int)(num+0.5) cast
		src = (int)(src+0.5);
	}
	else{
		// (int)(num-0.5)
		src = (int)(src-0.5);
	}
	// 10^-keta
	src /= pow(10.0, (double)(keta-1));
	
	return src;
}

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

C++: #include<iostream>
#include<algorithm>
#include<iomanip>
using namespace std;
main(){
	double x[2][3],n,ans[2],tmp;
	while(cin>>x[0][0]>>x[0][1]>>x[0][2]>>x[1][0]>>x[1][1]>>x[1][2]){
		/*for(int i=0;i<=1;++i){
			for(int j=0;j<=2;++j){
				cin>>x[i][j];
				ans[i]=0;
			}
		}*/
		n=x[0][0]*x[1][1]-x[0][1]*x[1][0];
		for(int i=0;i<=1;++i){
			for(int j=0;j<=1;++j){
				x[i][j]/=n;
			}
		}
		double tmp;
		tmp=x[1][1];
		x[1][1]=x[0][0];
		x[0][0]=tmp;
		x[0][1]*=-1;
		x[1][0]*=-1;

		for(int i=0;i<=1;++i){
			for(int j=0;j<=1;++j){
				ans[i]+=x[i][j]*x[j][2];
			}
		}
		cout<<fixed<<setprecision(3)<<ans[0]<<" "<<ans[1]<<endl;
	}
}

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


int main(){
	vector<double> ans_x;
	vector<double> ans_y;
	double a, b, c, d, e, f;
	double tb, tc, te, tf;
	double x, y;
	int i, cnt=0;
	while(cin>>a>>b>>c>>d>>e>>f){
		tb=b*d;
		tc=c*d;
		te=e*a;
		tf=f*a;
		tb-=te;
		tc-=tf;
		y=tc/tb;
		x=(c-b*y)/a;
		ans_x.push_back(x);
		ans_y.push_back(y);
		cnt++;
	}
	for(i=0;i<cnt;i++){
	//	cout.precision(4);
	//	cout.setf(ios::showpoint);
		printf("%.3f %.3f\n",ans_x[i], ans_y[i]);
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	long double a,b,c,d,e,f;
	while(cin>>a>>b>>c>>d>>e>>f){
		long double x=(c*e-f*b)/(a*e-d*b);
		long double y=(c*d-f*a)/(b*d-e*a);
		cout<<fixed<<setprecision(3)<<(x==-0?0:x)<<" "s;
		cout<<fixed<<setprecision(3)<<(y==-0?0:y)<<"\n"s;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

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

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

int main() {
    string line;
    while (getline(cin, line)) {
        double a, b, c, d, e, f;
        stringstream ss(line);
        ss >> a >> b >> c >> d >> e >> f;


        double x = 0.0;
        if (c*e - b*f != 0)
            x = static_cast<double>(c*e - b*f) / (a*e - b*d);
        double y = 0.0;
        if (a*f - c*d != 0)
            y = static_cast<double>(a*f - c*d) / (a*e - b*d);
        cout.setf(ios_base::fixed, ios_base::floatfield);
        cout << std::setprecision(3) << x << " " << y << endl;
    }
}

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