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> //üoÍ
#include <vector>   //®Izñ
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
	double n;
	while(cin >> n){
		vector<double> vec;
		vec.push_back(n);
		for(int i=0;i<5;i++){
			cin >> n;
			vec.push_back(n);
		}
		double x = ((vec[2]*vec[4])-(vec[1]*vec[5]))/((vec[0]*vec[4])-(vec[1]*vec[3]));
		double y = (vec[2]-(vec[0]*x))/vec[1];

		x = floor((x*1000)+0.5)/1000;
		y = floor((y*1000)+0.5)/1000;
		printf("%.3f %.3f\n", x, y);
		
	}
	
		return 0;
}

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



int main()
{
double x1,x2,y1,c1,y2,c2,y,x;
while((scanf("%lf %lf %lf %lf %lf %lf",&x1,&x2,&y1,&y2,&c1,&c2))!=EOF)
{
x=((c1*y1-x2*c2)/(x1*c1-x2*y2));
y=((-(y2*y1)+x1*c2)/(x1*c1-x2*y2));
if(x==0)
{
x=0;
}
if(y==0)
{
y=0;
}
printf("%.3lf %.3lf\n",x,y);
}
return 0;
}

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

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

	cin >> a >> b >> c >> d >> e >> f;

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

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

	return 0;
}

C++: #include <iostream>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <queue>
#include <string>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
using namespace std;
#define F first
#define S second
const int INF=100000000;

int dp[50][3001];
const int mod=100000;

int main(){
	while(1){
		double n[6];
		double tmp[6];
		for(int i=0; i<6; ++i){
			cin >> n[i];
			tmp[i]=n[i];
		}

		double p=n[1]/n[4];
		for(int i=3; i<6; ++i) tmp[i]=n[i]*p;
		double x=(tmp[2]-tmp[5])/(tmp[0]-tmp[3]);
		
		double q=n[0]/n[3];
		for(int i=3; i<6; ++i) tmp[i]=n[i]*q;
		double y=(tmp[2]-tmp[5])/(tmp[1]-tmp[4]);

		printf("%.3f %.3f\n",x,y);
		//cout << setprecision(3)  << x << " " << y << endl;
	}
	return 0;
}

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

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()
{
    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<bits/stdc++.h>
using namespace std;
int main(){
  double a[2][3];
  bool f=0;
  while(cin>>a[0][0]>>a[0][1]>>a[0][2]>>a[1][0]>>a[1][1]>>a[1][2]){
    if(a[0][0]==0)
      for(int i=0;i<3;i++)swap(a[0][i],a[1][i]),f=1;
    for(int i=0;i<2;i++){
      for(int j=i+1;j<3;j++)
	a[i][j]/=a[i][i];
      a[i][i]=1;
      for(int j=0;j<2;j++){
	if(j==i)continue;
	double t=a[j][i];
	for(int k=i;k<3;k++)
	  a[j][k]-=t*a[i][k];
      }
    }
    printf("%.3f %.3f\n",a[0][2],a[1][2]);
  }
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

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

C++: #include <stdio.h>

int main()
{
	int a,b,c,d,e,f;
	double def;
	double x,y;
	while(scanf("%d %d %d %d %d %d",&a, &b, &c, &d, &e, &f) != EOF){
		if((a * e - b * d) != 0){
			def = 1 / (double)(a * e - b * d);
		}else{
			printf("NA\n");
			continue;
		}
		x = def * (double)(e * c - b * f);
		y = def * (double)(a * f - d * c);
		printf("%lf %lf\n",x,y);
	}
	return 0;
}

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

double get_num(double x){
	x = x * 1000;
	if(x >= 0){
		x = (int)(x + 0.5);
		return ((double)x / 1000);
	} else {
		x = (int)(x - 0.5);
		return ((double)x / 1000);
	}
}

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

C++: include <stdio.h>

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

    while(scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF) {
        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>
#include<math.h>
void solution(int a,int b,int c,int d,int e,int f);
double x,y;
int main()
{
    int a,b,c,d,e,f;
    while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)==6)
    {
        solution(a,b,c,d,e,f);
        printf("%0.3lf %0.3lf\n",x,y);
    }
    return(0);
}
void solution(int a,int b,int c,int d,int e,int f)
{
    double number_1,number_2,number_3,correction;
    number_1=c*e-b*f;
    number_2=a*f-c*d;
    number_3=a*e-b*d;
    if((number_1==0)&&(number_3<0)&&(number_2!=0))
    {
        correction=-1*number_3;
        x=number_1/correction;
        y=number_2/number_3;
    }
    else if((number_2==0)&&(number_3<0)&&(number_1!=0))
    {
        correction=-1*number_3;
        x=number_1/number_3;
        y=number_2/correction;
    }
    else if((number_1==0)&&(number_3<0)&&(number_2==0))
    {
        correction=-1*number_3;
        x=number_1/correction;
        y=number_2/correction;
    }
    else
    {
        x=number_1/number_3;
        y=number_2/number_3;
    }
    return;
}