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>
using namespace std;
int main()
{
    int n;cin>>n;
    for(int i=0;i<n;++i){
        double abdx,abdy,cddx,cddy;
        double x[4];
        double y[4];
        for(int j=0;j<4;++j){
            cin>>x[j]>>y[j];
        }
        abdx=x[0]-x[1];
        cddx=x[2]-x[3];
        abdy=y[0]-y[1];
        cddy=y[2]-y[3];
        if(abdy/abdx==cddy/cddx)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

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

using namespace std;

int main(){
    
  int n;
  cin >> n;
  while(n--){

    double x1,x2,x3,x4;
    double y1,y2,y3,y4;

    scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
    if( (y2-y1)/(x2-x1) == (y4-y3)/(x4-x3) ){
      printf("YES\n");
    }
    else printf("NO\n");
  }
}

C++: n = input()+1
for v in range(1,n):
        (x1,y1,x2,y2,x3,y3,x4,y4)=map(int,raw_input().split())
        if x2-x1=0 or x4-x3=0:
                if x2-x1=0 and x4-x3=0:
                        print "YES"
                else:
                        print "NO"
        elif y2-y1=0 or y4-y3=0:
                if y2-y1=0 and y4-y3=0:
                        print "YES"
                else:
                        print "NO"
        else:
                a = (y2-y1)/(x2-x1)

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>

typedef long long ll;
using namespace std;

int main()
{
	double pos[8];

	for(int i=0;i<8;i++){
		scanf("%lf",pos+i);
	}

	if((pos[1]-pos[3])/(pos[0]-pos[2])==(pos[1+4]-pos[3+4])/(pos[0+4]-pos[2+4])){
		cout << "YES" << endl;
	}else
	{
		cout << "NO" << endl;	
	}
}

C++: #include<iostream>
#include<vector>
int main()
{
	int n;
	std::cin >> n;
	std::vector<bool>result(n);
	for (int i = 0; i < n; i++)
	{
		long double x1, y1, x2, y2, x3, y3, x4, y4;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		result[i] = x1 == x2 && x3 == x4 || (y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4);
	}
	for (auto i : result)
	{
		std::cout << (i ? "YES" : "NO") << std::endl;
	}
	return 0;
}

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

const double EPS = 1e-9;

signed main() {
  int n;

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

  return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-11
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<double,double> P;
static const int INF=1<<24;

int main(){
	double x[3],y[3];
	int n;
	cin>>n;
	rep(i,n){
		rep(j,4){
			cin>>x[j]>>y[j];
			//cout<<x[j]<<" "<<y[j]<<endl;
		}
		P a( x[1]-x[0] ,y[1]-y[0]), b( x[3]-x[2] ,y[3]-y[2]);
		bool f;
		if(abs(a.F*b.S-b.F*a.S)<=EPS) f=true;
		else f=false;
		//CP c(3.0,2.0);
		//cout<<real(c)<<" "<<imag(c)<<endl;
		//cout<<real(a)<<" "<<imag(a)<<" "<<real(b)<<" "<<imag(b)<<endl;
		if(f) cout<<"YES\n";
		else cout<<"NO\n";
	}
	return 0;
}

C++: //AOJ 0021
#include <stdio.h>
//x???y?????????????????????????????????????????????
int main(){
    double x1,y1,x2,y2,x3,y3,x4,y4;
    double m1,m2;
    int n,i;
    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);
    	m1=(y2-y1)/(x2-x1);
    	m2=(y4-y3)/(x4-x3);
    	if(m1==m2)puts("YES");
    	else puts("NO");
    	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

C++: #include <iostream>
#include <complex>
#include <cmath>
#include <string>
using namespace std;
typedef complex<double> C;
#define EPS (1e-8)
#define EQ(a,b) (abs((a)-(b)) < EPS)
const string mes[2] = {"YES","NO"};
double cross(C a, C b) {
  return a.real()*b.imag() - a.imag()*b.real();
}

bool is_paralelle(C a, C b) {
  return EQ(cross(a,b), 0.0);
}

void solve() {
  double x1, y1, x2, y2, x3, y3, x4, y4;
  cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
  
  C a(x1, y1), b(x2, y2), c(x3, y3), d(x4, y4);
    
  int res = (is_paralelle(a-b, c-d))?0:1;
  cout<<mes[res]<<endl;
}

int main (int argc, char const* argv[]) {
  int n; cin>>n;
  for(int i=0;i<n;i++) solve();
  return 0;
}

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

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

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

int main(){
	int n;
	cin >> n;
	for(int i = 1;i<=n ;i++){
		double x[5];
		double y[5];
		for(int j= 1;j<=4;j++) {
			cin >> x[j];
			cin >> y[j];
		}
		if ((y[2]-y[1])*(x[4]-x[3])==(y[4]-y[3])*(x[2]-x[1])) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

C++: #include <iostream>

using namespace std;

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

	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> x1[i] >> y1[i] >> x2[i] >> y2[i] >> x3[i] >> y3[i] >> x4[i] >> y4[i];

		if ((x2[i] - x1[i]) / (y2[i] - y1[i]) == (x4[i] - x3[i]) / (y4[i] - y3[i]))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}

	return 0;
}