Go: package main

import (
        "fmt"
        "math/big"
)

func main() {
        var x1, x2, x3, x4, y1, y2, y3, y4 big.Float
        var n int
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                fmt.Scanf("%f %f %f %f %f %f %f %f",
                        &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
                var lx, ly, mx, my, mul1, mul2, sub, zz big.Float
                lx.Sub(&x2, &x1)
                ly.Sub(&y2, &y1)
                mx.Sub(&x4, &x3)
                my.Sub(&y4, &y3)
                mul1.Mul(&lx, &my)
                mul2.Mul(&ly, &mx)
                sub.Sub(&mul1, &mul2)
                zz.SetFloat64(0.0)

                if sub.Cmp(&zz) == 0 {
                        fmt.Println("YES")
                } else {
                        fmt.Println("NO")
                }
        }
}

C++: #include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
    int n;
    cin>>n;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    for(int i=0;i<n;i++){
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        if((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)){
        cout"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <cmath>
#define rep(i,a,n) for(int i=a; i<n; i++)
using namespace std;

int main() {
    int n; cin >> n;
    for(int i=0; i<n; i++) {
        double x1, y1, x2, y2, x3, y3, x4, y4;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        
        double a1 = x2 - x1;
        double b1 = y2 - y1;
        double a2 = x4 - x3;
        double b2 = y4 - y3;
        
        if(a1 * b2 - a2 * b1 < 1e-10) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

C++: 
#include<iostream>
#include<cmath>

using namespace std;
#define EPS 0.0000001
int main(){

	int n; cin >> n;
	double x[4],y[4]; //??\????????§?¨?

	for(int i=0;i<n;i++){
		for(int j=0;j<4;j++){
			cin >> x[j] >> y[j];
		}

		if( abs((y[0]-y[1])*(x[3]-x[2]) + (x[0]-x[1])*(y[2]-y[3])) < EPS  ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: //#define _USE_MATH_DEFINES
//#include <cmath>
#include <iostream>
//#include <stdio.h>
//#include <stdlib.h>
//#include <iomanip>
//#include <vector>
#include <string>
//#include <algorithm>
//#include <functional>
//#include <time.h>
//#include <sstream>
//#include <queue>

using namespace std;


int main(){

	int n;
	double p[8];

	cin >> n;

	while (n--){
		for (int i = 0; i < 8; i++){
			cin >> p[i];
		}

		if (p[0] == p[2] || p[4] == p[6]){
			if (p[0] == p[2] && p[4] == p[6])cout << "YES" << endl;
			else cout << "NO" << endl;
		}
		else{
			if ((p[3] - p[1]) / (p[2] - p[0]) == (p[7] - p[5]) / (p[6] - p[4])) cout << "YES" << endl;
			else cout << "NO" << endl;
		}


	}


	return 0;
}

C++: import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		double x1,x2,x3,x4,y1,y2,y3,y4;
		int T=in.nextInt();
		for(int t=1;t<=T;t++){
			x1=in.nextDouble();
			x2=in.nextDouble();
			x3=in.nextDouble();
			x4=in.nextDouble();
			y1=in.nextDouble();
			y2=in.nextDouble();
			y3=in.nextDouble();
			y4=in.nextDouble();
			if(Math.abs((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4))<0.000000000001)
				System.out.println("YES");
			else
				System.out.println("NO");
		}
		in.close();
	}
}

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

int main(){
	int n;
	double x[4], y[4];
	cin >> n;
	while (n--){
		for (int i = 0; i < 4; i++)
			cin >> x[i] >> y[i];
		if ((x[0] - x[1]) / (y[0] - y[1]) == (x[2] - x[3]) / (y[2] - y[3]))
			puts("YES");
		else
			puts("NO");
	}
	return 0;
}

C++: //
//
//
//
//
//
//

#include <iostream>
#include <complex>

using namespace std;
typedef complex<double> xy_t;

double cross_product(complex<double> a, complex<double> b)
{
  return (conj(a) * b).imag();
}

int main()
{
  int n; //??????????????°
  cin >> n;
  while (n > 0) {
    complex<double> a, b, c, d, e, f;
    double real[4], imag[4];
    for (int i = 0; i < 4; i++)
      cin >> real[i] >> imag[i];
    
    a = xy_t(real[0], imag[0]);
    b = xy_t(real[1], imag[1]);
    c = xy_t(real[2], imag[2]);
    d = xy_t(real[3], imag[3]);
    
    /*
    a.real() = array[0];
    a.imag() = array[1];
    b.real() = array[2];
    b.imag() = array[3];
    c.real() = array[4];
    c.imag() = array[5];
    d.real() = array[6];
    d.imag() = array[7];
    */
    
    e = a - b;
    f = c - d;
    double judge = cross_product(e, f);
    if (judge == 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
    n--;
  }
}

/*
complex?????????????§????????????§???????????????????????????????????§??¨??£???????????????????????????
????????\????????????????????????????????????????????¨???????????????
 */

C++: #include<iostream>
using namespace std;
int main() {
  int n;
  cin>>n;
  double x1,x2,x3,x4,y1,y2,y3,y4;
  for(int i=0;i<n;i++){ 
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if( ( (y2-y1)/(x2-x1) )== ( (y4-y3)/(x4-x3) ) )
      cout<<"YES";
    else
      cout<<"NO";
    cout<<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<cmath>

using namespace std;
#define EPS 0.0000001
 
 
main(){
  int tcase;   cin >> tcase;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  for ( int i = 0; i < tcase; i++ ){
      cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
 
   
      if ( abs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1) ) < EPS ) cout << "YES" << endl;
      else cout << "NO" << endl;
  }
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <sstream>
#include <complex>
using namespace std;
typedef complex<long> xy_t;
long cross_product(xy_t a, xy_t b) { return (conj(a) * b).imag(); }
vector<string> StringSplit(const string &str, char sep)
{
	vector<std::string> v;
	stringstream ss(str);
	string buffer;
	while (getline(ss, buffer, sep))
	{
		v.push_back(buffer);
	}
	return v;
}
int main()
{
	string num;
	int n;
	cin >> n;
	while (n--)
	{
		long xy[8];
		for (int i = 0; i < 8; i++)
		{
			cin >> num;
			auto num_s = StringSplit(num, '.');
			auto lambda = [&](int dec) {int l = 5 - num_s[1].length(); while (l--) { dec *= 10; }if (num[0] == '-') { dec *= -1; }return dec; };
			int num_i = stoi(num_s[0]) * 100000 + lambda(stoi(num_s[1]));
			xy[i] = num_i;
		}
		long cp = cross_product(xy_t(xy[2] - xy[0], xy[3] - xy[1]), xy_t(xy[6] - xy[4], xy[7] - xy[5]));
		if (cp == 0)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
  int n;
  cin>>n;
  rep(i,n){
    double ax,ay,bx,by,cx,cy,dx,dy;
    cin>>ax>>ay>>bx>>by>>cx>>cy>>dx>>dy;

    //if(by-ay)/(bx-ax)=(dy-cy)/(dx-cx)
    if((ax-bx)*(cy-dy)==(cx-dx)*(ay-by))cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
}

C++: #include <iostream>

int main(){
	
	double a,x1,y1,x2,y2,x3,y3,x4,y4;
	std::cin>>a;
	for(int s=0;s<a;s++){
		std::cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)||(y2-y1)/(x2-x1)==-1/((y4-y3)/(x4-x3)){
			std::cout<<"YES"<<std::endl;
		}else{
			std::cout<<"NO"<<std::endl;
		}
		
    }
    return 0;
}

C++: #include <cstdio>
#include <cmath>
#include <cfloat>

int n;

int main(){
	scanf("%d", &n);
	for(int i = 0; i < n; ++i){
		double x[4][2];
		for(int j = 0; j < 4; ++j){
			scanf("%lf%lf", x[j], x[j] + 1);
		}
		double y[2][2] = {
			{x[0][0] - x[1][0], x[0][1] - x[1][1]},
			{x[2][0] - x[3][0], x[2][1] - x[3][1]}
		};

		//printf("%lf\n", y[0][0] * y[1][1] - y[0][1] * y[1][0]);

		if(std::abs(y[0][0] * y[1][1] - y[0][1] * y[1][0]) < DBL_EPSILON){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}
	return 0;
}