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++: #include<iostream>
#include<cmath>
 
using namespace std;

#define EPS 1e-5
 
struct point{
	double x;
	double y;
};

struct line{
	double a;
	double b;
};

bool get_line( const point& a , const point& b , line *a_b );
istream& operator >> ( istream& s , point& p );
 
int main(void)
{
	point a, b, c, d;
 
    line a_b, c_d;
 
    bool result1 , result2;
 
    int num;
 
    cin >> num;
 
    for( int i = 0 ; i < num ; i++ )
    {
        cin >> a >> b >> c >> d;
 
        result1 = get_line( a , b , &a_b );
        result2 = get_line( c , d , &c_d );
 
        if( result1 == false && result2 == false )
        {
            cout << "YES" << endl;
        }
        else
        {
            if( fabs(a_b.a - c_d.a) < EPS ) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
    }
 
    return 0;
}

istream& operator >> ( istream& s , point& p )
{
	return s >> p.x >> p.y;
}

bool get_line( const point& a , const point& b , line *a_b )
{
	if( fabs(a.x - b.x) < EPS ) return false;
	else{
		a_b->a = (a.y - b.y)/(a.x - b.x);
		a_b->b = a.y - (a.x * a_b->a);
		return true;
	}
}

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

int main()
{
    int n;
    cin>>n;
    while(n--){
        pair<double,double>a[4];
        for(int i=0;i<4;i++){
            cin>>a[i].first>>a[i].second;
        }
        if(abs((a[1].first-a[0].first)*(a[3].second-a[2].second)-(a[3].first-a[2].first)*(a[1].second-a[0].second))<0)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}

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

int main() {
	int N;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    cin >> N;
    for (int n = 0; n != N; ++n) {
        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>
using namespace std;
int main(){
  int n;
  double xa,ya,xb,yb,xc,yc,xd,yd,a2,a1;
  while(cin>>n){
    for(int i=0;i<n;i++){
      cin>>xa>>ya>>xb>>yb>>xc>>yc>>xd>>yd;
      a1=(yb-ya)/(xb-xa);
      a2=(yd-yc)/(xd-xc);
      if(a1==a2)cout<<"YES"<<endl;
      else cout<<"NO"<<endl;
    }
  }
  return 0;
}

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

typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
const double eps = 1e-11;
double x[4],y[4];
int N;
int main() {
	cin >> N;
	for (int i=0; i<N; ++i) {
		for (int i=0; i<4; ++i) {
			cin >> x[i] >> y[i];
		}
		xy_t a[2] = {
					xy_t(x[0],y[0]) - xy_t(x[1],y[1]),
					xy_t(x[2],y[2]) - xy_t(x[3],y[3])
				};
		bool p = abs(cross_product(a[0],a[1]))/2 == 0;
		cout << ( p ? "Yes" : "No") << endl;
	}
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
using namespace std;
int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> n;
	for (int z = 0; z < n; z++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if(((x2 - x1)*(y4 - y3))-((x4 - x3)*(y2 - y1))==0.000) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

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

int main(void){
	double x1=101,y1=101,x2=101,y2=101,x3=101,y3=101,x4=101,y4=101;
	double abConcurrentX,abConcurrentY,cdConcurrentX,cdConcurrentY;
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
	if(x1==101 or y1==101 or x2==101 or y2==101 or x3==101 or y3==101 or x4==101 or y3==101){
		return 0;
	}
	abConcurrentX = x1-x2;
	abConcurrentY = y1-y2;
	cdConcurrentX = x3-x4;
	cdConcurrentY = y3-y4;
	if((abConcurrentX == cdConcurrentX or abConcurrentX == -abConcurrentX) and (abConcurrentY == cdConcurrentY or abConcurrentY == -cdConcurrentY)){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
typedef pair<double,double> pdd;
int main(){
    pdd no1,no2,no3,no4;
    int n;cin>>n;
    rep(i,n){
        cin>>no1.first>>no1.second>>no2.first>>no2.second>>no3.first>>no3.second>>no4.first>>no4.second;
        double d1=(no2.second-no1.second)/(no2.first-no1.first);
        double d2=(no4.second-no3.second)/(no4.first-no3.first);
        if(d1==d2)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
using ld = long double;
const ld eps = 1e-14;

int main()
{
	int n;
	ld x1, x2, x3, x4, y1, y2, y3, y4;
	cin >> n;
	while (n--) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		ld dx1 = x2 - x1, dy1 = y2 - y1;
		ld dx2 = x4 - x3, dy2 = y4 - y3;
		if (abs(dx1 * dy2 - dy1 * dx2) < eps && dx1 * dx2 + dy1 * dy2 > -eps) {
			puts("YES");
		}
		else {
			puts("NO");
		}
	}
	return 0;
}

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

using namespace std;

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  cin >> n;
  while(n--){
  cin >>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;

  if(fabs((y1-y2)*(x3-x4)-(x1-x2)*(y3-y4))<10e-12){
      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;
    int xa,ya,xb,yb,xc,yc,dx,dy;
    int a,b;
    for(int i = 0;i < num;i++){
        std::cin >> xa >> ya>> xb >> yb >> xc >> yc >> dx >> dy;
        a = (yb - ya) / (xb - xa);
        b = (dy - yc) / (dx - xc);
        if(a == b){
            printf("YES");
        }else{
            printf("NO");
        }
    }
    
    }

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

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
#include <list>
#include <cstdlib>
#include <cmath>
#define _USE_MATH_DEFINES

using namespace std;

int main() {

	int n;
	double x[4] = { 0 }, y[4] = { 0 };
	double slope1, slope2;

	cin >> n;

	while (n) {

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

		slope1 = (y[1] - y[0]) / (x[1] - x[0]);
		slope2 = (y[3] - y[2]) / (x[3] - x[2]);

		if (slope1 == slope2) {
			cout << "YES" << endl;
		}
		else
			cout << "NO" << endl;
			n--;
	}
	return 0;
}