Go: package main

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

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]
		var mulA, mulD int
		if a < 0 {
			mulA = a * -1
		} else {
			mulA = a
		}
		if d < 0 {
			mulD = d * -1
		} else {
			mulD = d
		}
		a *= mulD
		b *= mulD
		c *= mulD
		d *= mulA
		e *= mulA
		f *= mulA

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

		bE := b - e
		cF := c - f
		if bE == 0 {
			bE = 1
		}
		y := cF / bE
		x := (c - (y * b)) / a

		fmt.Print(x)
		fmt.Println(".000")
		fmt.Print(y)
		fmt.Println(".000")
	}
}

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

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

	while (cin >> a >> b >> c >> d >> e >> f) {
		if (a == 0) {
			x = 0;
			y = c / b;
		}else if (b == 0) {
			x = c / a;
			y = 0;
		}else {
			x = (c * e - b * f) / (a * e - b * d);
			if (0 == x) { x = 0; }
			y = (c - a * x) / b;
		}
		cout << fixed << setprecision(3) << x << ' ' << y << endl;
	}
    return 0;
}

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

C++: #include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>

#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)

using namespace std;

int main(void){
    
    int i,j=0,k = 0,l=0,m = 0,n= 0;
    double a,b,c,d,e,f;
    double x1,x2;
    
    cin >> a >> b >> c;
    cin >> d >> e >> f;
    
    double gyouretusiki = (a*e - d*b);
    
    x1 = (c/a) - (b/gyouretusiki)*(f -((d*c)/a));
    
    x2 = ((a) /(gyouretusiki))*(f-((d*c)/a));
    
    REP(i,5)
    {
    x1 =x1*10;
    x2 = x2*10;
    }
    x1 += 0.5;
    x2 += 0.5;
    x1 = (int)x1;
    x2 = (int)x2;
    REP(i,5)
    {
        x1 =x1/10;
        x2 = x2/10;
    }
    
    printf("%.3f %.3f\n",x1,x2);
    return 0;
            
                  
                  
    
}

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

int main()
{
	double x, y, a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f) {
		y = (c*d - a*f) / (b*d - a*e);
		x = (c - b*y) / a;
		cout << fixed << setprecision(3) << x << ' ' << y << '\n';
	}
}

C++: #include <iostream>
#include<cstdio>
 
using namespace std;
 
int main()
{
    double a, b, c, d, e, f, tmp, s, t;
     
    while((cin >> a >> b >> c >> d >> e >> f)){
        tmp = (a*e-b*d);
        s = ((e*c-b*f)/tmp);
        t = ((a*f-d*c)/tmp);
         
        if(s == -0.0){
            s = 0.0;
        }
        if(t == -0.0){
            t = 0.0;
        }
        printf("%.3f %.3f\n", s, t);
    }
     
    return 0;
}

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

const double EPS = 1e-8;
typedef vector<double> Vec;
typedef vector<Vec> Mat;

void show(const Mat &m)
{
	puts("====");
	for (int i = 0; i < m.size(); i++){
		for (int j = 0; j < m[i].size(); j++){
			printf("%f ", m[i][j]);
		}
		puts("");
	}
	puts("====");
}

Vec gauss_jordan(const Mat &A, const Vec &b)
{
	int n = A.size();
	Mat B(n, Vec(n + 1));
	
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			B[i][j] = A[i][j];
		}
		B[i][n] = b[i];
	}
	
	for (int i = 0; i < n; i++){
		int pivot = i;
		for (int j = i; j < n; j++){
			if (abs(B[j][i]) > abs(B[pivot][i])){
				pivot = j;
			}
		}
		swap(B[i], B[pivot]);
		
		if (abs(B[i][i]) < EPS) return Vec();
		
		for (int j = i + 1; j <= n; j++){
			B[i][j] /= B[i][i];
		}
		for (int j = 0; j < n; j++){
			if (i != j){
				for (int k = i + 1; k <= n; k++){
					B[j][k] -= B[j][i] * B[i][k];
				}
			}
		}
		
		//show(B);
	}
	
	Vec x(n);
	for (int i = 0; i < n; i++){
		x[i] = B[i][n];
	}
	
	return x;
}

int main()
{
	while (true){
		Mat A(2, Vec(2));
		Vec b(2);
		
		for (int i = 0; i < 2; i++){
			for (int j = 0; j < 2; j++){
				scanf("%lf", &A[i][j]);
			}
			scanf("%lf", &b[i]);
		}
		
		Vec res = gauss_jordan(A, b);
		printf("%.3f %.3f\n", res[0], res[1]);
	}
	
	return 0;
}

C++: #include <cstdio>

int main(){
	int arr[10][10],p,q;
	float h[5];

	while(scanf("%d %d %d %d %d %d",&arr[1][1],&arr[1][2],&arr[1][3],&arr[2][1],&arr[2][2],&arr[2][3])!=EOF){
		//printf("%d %d %d %d %d %d \n",arr[1][1],arr[1][2],arr[1][3],arr[2][1],arr[2][2],arr[2][3]);
		/*if(arr[1][1] < 0){
			for(int k = 1;k<4;k++){
				arr[1][k] = arr[1][k]*(-1);
			}
		}

		if(arr[2][1] < 0){
			for(int l = 1;l<4;l++){
				arr[2][l] = arr[2][l]*(-1);
			}
		}*/

		for(int i = 4;i<7;i++){
			arr[1][i] = arr[1][i-3]*arr[2][1];
			arr[2][i] = arr[2][i-3]*arr[1][1];
		}

		p = arr[1][5]-arr[2][5];
		q = arr[1][6]-arr[2][6];

		h[2] = q/p;

		h[1] = (arr[1][3]-(arr[1][2]*h[2]))/arr[1][1];

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

C++: int gcm(int a,int b){
	int c=a%b;
	while(c!=0){
		a=b;
		b=c;
		c=a%b;
        }
	return b;
}

int main(){
	int x[2],y[3],sum[3];
	double ans[2];
	while(cin>>x[0]>>y[0]>>sum[0]>>x[1]>>y[1]>>sum[1]){
		if(x[0]==0){
			ans[1]=(double)sum[0]/y[0];
			ans[0]=(sum[1]-y[1]*ans[1])/x[1];
		}else if(x[1]==0){
			ans[1]=(double)sum[1]/y[1];
			ans[0]=(sum[0]-y[0]*ans[1])/x[0];
		}else if(y[0]==0){
			ans[0]=(double)sum[0]/x[0];
			ans[1]=(sum[1]-x[1]*ans[0])/y[1];
		}else if(y[1]==0){
			ans[0]=(double)sum[1]/x[1];
			ans[1]=(sum[0]-x[0]*ans[0])/y[0];
		}else{
			y[2]=y[0]*x[1]-y[1]*x[0];
			sum[2]=sum[0]*x[1]-sum[1]*x[0];
			ans[1]=(double)sum[2]/y[2];
			ans[0]=(sum[0]-y[0]*ans[1]);
		}
		printf("%.3f %.3f\n",ans[0],ans[1]);
	}
	return 0;
}

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

class Calc{
    public:
    double A[N][N+1];
    int i, j, k;

    void calcSi();
    void printSi();
}

void Calc::calcSi(){
    for(i=0;i<N-1;i++){
        for(j=i+1;j<N;j++){
            int tmp = A[j][i] / A[i][i];
            for(k=i+1; k<=N; k++)
                A[j][k] -= A[i][k] * tmp;
        }
    }

    for(i=N-1; i>=0; i--){
        tmp = A[i][N];
        for(j=i+1;j<N;j++)
            tmp -= A[i][j] * A[j][N];
        A[i][N] = tmp / A[i][i];
    }
}

void Calc::printSi(){
    for(i=0;i<N;i++){
        printf("%.3f",A[i][N]);
        if(i != N) {
            cout << " ";
        }
    }
    cout << endl;
}

int main(void){
    Calc c;
    int i;
    while(cout >> c.A[0][0] >> c.A[0][1] >> c.A[0][2] >> c.A[1][0] >> c.A[1][1] >> c.A[1][2])
    {
        c.calcSi();
        c.printSi();
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector> 
#include <iomanip>
int main()
{
	std::vector<double> x, y;
	double a, b, c, d, p, q;
	while (scanf("%d %d %d %d %d %d", &a, &b, &p, &c, &d, &q) != EOF)
	{
		x.push_back((d*p - b*q) / (a*d - b*c));
		y.push_back((a*q - c*p) / (a*d - b*c));
	}

	for (int i = 0; i < x.size(); ++i)
		std::cout << std::setprecision(10) << x[i] << " " << std::setprecision(10) << y[i] << std::endl;
	return 0;
}