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

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

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


int main() {
  float a, b, c, d, e, f;
  float x, y;
  cout << setprecision(3) << fixed;
    while(cin >> a >> b >> c >> d >> e >> f) {
    x=(b*f-c*e)/(b*d-a*e);
    x = round(x * 1000) / 1000.0;
    cout<<x;
    cout<<" ";
    
    y=(c*d-a*f)/(b*d-a*e);
    y = round(y * 1000) / 1000.0;
    cout<<y;
    cout<<endl;
  }
  
  return 0;
}

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

int main() {
	// your code goes here

  double a,b,c,d,e,f;

  while(cin >> a >> b >> c >> d >> e >> f ){

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

    double x = (c-b*y)/a;


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

  }
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e,f;
    double res1,res2;
    while(cin>>a>>b>>c>>d>>e>>f)
    {
        int val1=a*e;
        int val2=d*b;
        int res1=val1-val2;
        int val3=e*c;
        int val4=b*f;
        int res2=val3-val4;
        int val5=d*c;
        int val6=a*f;
        int res3=val5-val6;
        double sum1=(double)res2/(double)res1;
        double sum2=(-1)*((double)res3/(double)res1);
        printf("%.3lf %.3lf\n",sum1,sum2);
    }
    return 0;
}

C++: #include <iomanip>
#include <iostream>
#include <vector>
#define N 2
 
using namespace std;
typedef vector< vector<double> > Equation;
 
bool input(Equation& c)
{
	if (!cin) return false;

    for (int i = 0; i < N; ++i)
        for (int j = 0; j < N + 1; ++j)
            cin >> c[i][j];
 
    return true;
}
 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
 
    Equation c(N, vector<double>(N + 1));
	while (cin >> c[0][0] >> c[0][1] >> c[0][2] >> c[1][0] >> c[1][1] >> c[1][2])
	{
		// 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];
        }
 
        cout << setprecision(4) << fixed << c[0][N];
        for (int i = 1; i < N; ++i)
            cout << " " << c[i][N];
        cout << endl;
    }
 
    return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
void calc(double x1, double y1, double a, double x2, double y2, double b)
{
	double d1 = x2;
	double d2 = x1;
	double xx1 = d1 * x1;
	double xy1 = d1 * y1;
	double a1 = d1 * a;
	double xx2 = d2 * x2;
	double xy2 = d2 * y2;
	double b1 = d2 * b;
	double y = xy1 - xy2;
	double c = a1 - b1;
	y = c / y;


	d1 = y2;
	d2 = y1;
	xx1 = d1 * x1;
	xy1 = d1 * y1;
	a1 = d1 * a;
	xx2 = d2 * x2;
	xy2 = d2 * y2;
	b1 = d2 * b;
	double x = xx1 - xx2;
	c = a1 - b1;
	x = c / x;
	if (x == 0)
	{
		x = 0;
	}
	if (y == 0)
	{
		y = 0;
	}
	printf("%.3lf %.3lf\n", x, y);
}
int main()
{
	double x1, y1, a, x2, y2, b;

	while(scanf_s("%d %d %d %d %d %d", &x1, &y1, &a, &x2, &y2, &y2 , &b) != EOF)
	{
		calc(x1, y1, a, x2, y2, b);
	}

		
	return 0;
}

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


int main()
{
	double x1, y1, a, x2, y2, b;
	for (int i = 0; i < 2; i++)
	{
		cin >> x1 >> y1 >> a >> x2 >> y2 >> b;


		double d1 = x2;
		double d2 = x1;
		double xx1 = d1 * x1;
		double xy1 = d1 * y1;
		double a1 = d1 * a;
		double xx2 = d2 * x2;
		double xy2 = d2 * y2;
		double b1 = d2 * b;
		double y = xy1 - xy2;
		double c = a1 - b1;
		y = c / y;


		d1 = y2;
		d2 = y1;
		xx1 = d1 * x1;
		xy1 = d1 * y1;
		a1 = d1 * a;
		xx2 = d2 * x2;
		xy2 = d2 * y2;
		b1 = d2 * b;
		double x = xx1 - xx2;
		c = a1 - b1;
		x = c / x;
		if (x == 0)
		{
			x = 0;
		}
		if (y == 0)
		{
			y = 0;
		}
		printf("%.3lf %.3lf", x, y);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define INT(name) int name; scanf("%d",&name);
#define VINT(name,n) vector<int> name(n); for(int i = 0;i < n;i++) scanf("%d",&name[i]);

using namespace std;

int main(int argc, char const *argv[]){
	int a,b,c,d,e,f;
	while(cin >> a >> b >> c >> d >> e >> f){
		cout.precision(3);
		double answer =(c*e-b*f)/(a*e-b*d);
		cout << std::fixed << answer;
		answer = (a*f-c*d)/(a*e-b*d);
		cout << ' ' << std::fixed << answer << endl;
	}
}

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

int main(){
  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("%f.3 %f.3\n", x, y);
  
  return 0;
}