Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&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)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: //
//  practise.h
//  c++practise
//
//  Created by Ubnit04 on 2015/06/10.
//
//
#include <iostream>

using namespace std;

void Solution()
{
    int n;
    
    cin>>n;
    
    while(n--)
    {
        float x1, y1;
        float x2, y2;
        float x3, y3;
        float x4, y4;
        
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        
        float ab = (y2 - y1) / (x2 - x1); // when "y / x = " another line's data, it can be seen as parallel
        float cd = (y4 - y3) / (x4 - x3);
        
        if (ab == cd )
        {
            cout<<"YES"<<endl;
        }
        else
        {
            cout<<"NO"<<endl;
        }
    }
}

int main()
{
    Solution();
    return 0;
}

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)){
			std::cout<<"YES"<<std::endl;
		}else{
			std::cout<<"NO"<<std::endl;
		}
		
    }
    return 0;
}

C++: #include<cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define fori(i,k,n) for(int i=k;i<n;i++)
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
/*
(char)'1' - (int)48 = (int)1; 


*/


int main()
{
	int n;
	cin >> n;
	while (n--){
		double x[4], y[4];
		rep(i, 4)cin >> x[i]>>y[i];
		if ((x[1] - x[0])*(y[3] - y[2]) == (x[3] - x[2])*(y[1] - y[0]))
			cout << "YES" << endl;
		else cout << "NO" << endl;

	}
	return 0;

}

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

double calc(double dx1, double dy1, double dx2, double dy2) {

    if(dx1 == 0.0 || dx2 == 0.0) {
        return dx1 == dx2;
    }
    return (dy1/dx1) == (dy2/dx2);
}

int main() {
    int n, i;
    double x1, y1, x2, y2, x3, y3, x4, y4;

    scanf("%d", &n);
    for(i=0; i<n; ++i) {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
              &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
        if(calc(x2-x1, y2-y1, x4-x3, y4-y3)) {
            printf("YES\n");
        }else {
            printf("NO\n");
        }
    }

    return 0;
}

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

int main()
{
	int n;
	while (cin >> n)
	{
		double **a = new double*[n];
		char **b = new char*[n];
		for (int i = 0; i < n; i++)
		{
			a[i] = new double[8];
			b[i] = new char[4];
			memset(a[i], 0, sizeof(a[i]));
			memset(b[i], 0, sizeof(b[i]));
		}
		for (int i = 0; i < n; i++)
			for (int j = 0; j < 8; j++)
				cin >> a[i][j];
		for (int i = 0; i < n; i++)
			if (fabs(a[i][0] - a[i][2]) < 10e-3 || fabs(a[i][4] - a[i][6]) < 10e-3)
				if (fabs(a[i][0] - a[i][2]) < 10e-3 && fabs(a[i][4] - a[i][6]) < 10e-3)
					b[i][0] = 'Y', b[i][1] = 'E', b[i][2] = 'S';
				else
					b[i][0] = 'N', b[i][1] = 'O';
			else
				if(fabs((a[i][3]-a[i][1])/(a[i][2]-a[i][0])-(a[i][7]-a[i][5])/(a[i][6]-a[i][4]))<10e-3)
					b[i][0] = 'Y', b[i][1] = 'E', b[i][2] = 'S';
				else
					b[i][0] = 'N', b[i][1] = 'O';
		for (int i = 0; i < n; i++)
			cout << b[i] << endl;
		for (int i = 0; i < n; i++)
			delete a[i], b[i];
		delete a, b;
	}
	return 0;
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int n;
int main() {
    cin>>n;
    double x1,y1;
    double x2,y2;
    double x3,y3;
    double x4,y4;
    rep(i,n) {
        cin>>x1>>y1;
        cin>>x2>>y2;
        cin>>x3>>y3;
        cin>>x4>>y4;
        double tx1 = x1-x2 + 1e-8;
        double ty1 = y1-y2 + 1e-8;
        double tx2 = x3-x4 + 1e-8;
        double ty2 = y3-y4 + 1e-8;


        double t1 = tx1*ty2;
        double t2 = tx2*ty1;

        if(t1==t2) {
            cout<<"YES"<<endl;
        }
        else {
            cout<<"NO"<<endl;
        }

    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  double x[4],y[4];
  cin>>n;
  for(int i=0;i<n;i++){
    for(int j=0;j<4;j++)
      cin>>x[j]>>y[j];
    if(((y[3]-y[2])/(x[3]-x[2]))==((y[1]-y[0])/(x[1]-x[0]))) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

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

int main(void)
{
	double x1, x2, x3, x4, y1, y2, y3, y4, p1, p2;
	int n;

	cin >> n;

	rep(i, n)
	{
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		p1 = (y2 - y1) / (x2 - x1);
		p2 = (y4 - y3) / (x4 - x3);
		if (p1 == p2)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}

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

int main(int argc, const char * argv[]) {
    std::vector<int> r;
    int num;
    std::cin >> num;
    double xa,ya,xb,yb,xc,yc,dx,dy;
    
    for(int i = 0;i < num;i++){
        std::cin >> xa >> ya>> xb >> yb >> xc >> yc >> dx >> dy;
        double a = (yb - ya) / (xb - xa);
        double b = (dy - yc) / (dx - xc);
        if(a == b){
            printf("YES\n");
        }else{
            printf("NO\n");
        }
    }
}

C++: #include<stdio.h>
 
int main(void){
    double x[4],y[4];
    int n,i;
     
    scanf("%d",&n);
     
    for(i=0;i<n;i++){
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);
         
        if(((y[1]-y[0])/(x[1]-x[0])) == ((y[3]-y[2])/(x[3]-x[2])))printf("YES\n");
        else printf("NO\n");
    }
     
    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
const double eps = 1e-9;
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;
        x1 -= x2;
        y1 -= y2;
        x3 -= x4;
        y3 -= y4;
        cout << (abs(x1 * y3 - y1 * x3) < eps ? "YES" : "NO") << endl;
    }
    return 0;
}